def document_to_dict(instance, fields=None, exclude=None):
    data = {}
    for f in instance._fields.values():
        if fields and f.name not in fields:
            continue
        if exclude and f.name in exclude:
            continue
        data[f.name] = getattr(instance, f.name, '')
    return data
Creates a new external_policy.
dataset/ETHPy150Open jschrewe/django-mongodbforms/mongodbforms/documents.py/document_to_dict--crossover with--dataset/ETHPy150Open openstack/python-group-based-policy-client/gbpclient/v2_0/client.py/Client.create_external_policy