def METHOD_NAME(self, record, type, domain):
    url = '/domains/%s/records' % (domain)
    if record:
        url += '/%s' % (record)
        if type:
            url += '/%s' % (type)
    records, status = self._gandi_api_call(url, error_on_404=False)
    if status == 404:
        return []
    if not isinstance(records, list):
        records = [records]
    # filter by type if record is not set
    if not record and type:
        records = [r
                   for r in records
                   if r['rrset_type'] == type]
    return records