<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_records(zone_id, profile, type=None):
    '''
    List records for the given zone_id on the given profile

    :param zone_id: Zone to export.
    :type  zone_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param type: The record type, e.g. A, NS
    :type  type: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion libcloud_dns.list_records google.com profile1
    '''
    conn = _get_driver(profile=profile)
    zone = conn.get_zone(zone_id)
    if type is not None:
        return [_simple_record(record) for record in conn.list_records(zone) if record.type == type]
    else:
        return [_simple_record(record) for record in conn.list_records(zone)]