function createAttrDefFromDynamo (dynamoAttribute) {
  let dynamoType;
  const attrDef = {
    'type': module.exports.lookupType(dynamoAttribute)
  };
  if (attrDef.type === Object) {
    attrDef.type = 'map';
    for (dynamoType in dynamoAttribute) {
      attrDef.map = {};
      for (const subAttrName in dynamoAttribute[dynamoType]) {
        attrDef.map[subAttrName] = createAttrDefFromDynamo(dynamoAttribute[dynamoType][subAttrName]);
      }
    }
  } else if (attrDef.type === Array) {
    attrDef.type = 'list';
    for (dynamoType in dynamoAttribute) {
      attrDef.list = dynamoAttribute[dynamoType].map(createAttrDefFromDynamo);
    }
  }
  return attrDef;
}