<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collect_fields(node):
 """ Get all the unique field names that are eligible for optimization Requested a function like this be added to the ``info`` object upstream in graphene_django: https://github.com/graphql-python/graphene-django/issues/230 """

    fields = set()
    for leaf in node:
        if leaf.get('kind', None) == "Field":
            fields.add(leaf["name"]["value"])

        if leaf.get("selection_set", None):
            fields = fields.union(collect_fields(leaf["selection_set"]["selections"]))

    return fields