def setup_fields(attrs):
    """
    Collect all fields declared on the class and remove them from attrs
    """
    fields = {}
    iterator = list(attrs.items())
    for key, value in iterator:
        if not isinstance(value, Field):
            continue
        fields[key] = value
        del attrs[key]
    return fields