def _fields_list_to_dict(fields):
    as_dict = {}
    for field in fields:
        if not isinstance(field, basestring):
            raise TypeError("fields must be a list of key names, "
                            "each an instance of %s" % (basestring.__name__,))
        as_dict[field] = 1
    return as_dict
Takes a list of field names and returns a matching dictionary.
dataset/ETHPy150Open vmalloc/mongomock/mongomock/helpers.py/_fields_list_to_dict