<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_refs(profile, ref_type=None):
 """List all refs. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ref_type The type of ref you want. For heads, it's ``heads``. For tags, it's ``tags``. That sort of thing. If you don't specify a type, all refs are returned. Returns: A list of dicts with data about each ref. """

    resource = "/refs"
    if ref_type:
        resource += "/" + ref_type
    data = api.get_request(profile, resource)
    result = [prepare(x) for x in data]
    return result