human
Complete the below
def _TestQueryContacts(tester, user_cookie, request_dict):

    ''''Called by the ServiceTester in order to test query_contacts service API call.'
    '''
 ... Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    validator = tester.validator
    (user_id, device_id) = tester.GetIdsFromCookie(user_cookie)
    def _MakeContactDict(contact):
        'Create    a    contact    dict    from    the    contact    object    plus    its    referenced    identity    object.\n                '
        identity_dict = dict()
        for identity_key in contact.identities:
            identity = validator.GetModelObject(Identity, identity_key, must_exist=False)
            identity_dict[identity_key] = identity
        contact_dict = {'contact_id': contact.contact_id, 'contact_source': contact.contact_source}
        util.SetIfNotNone(contact_dict, 'name', contact.name)
        util.SetIfNotNone(contact_dict, 'given_name', contact.given_name)
        util.SetIfNotNone(contact_dict, 'family_name', contact.family_name)
        util.SetIfNotNone(contact_dict, 'rank', contact.rank)
        if ((contact.labels is not None) and (len(contact.labels) > 0)):
            contact_dict['labels'] = list(contact.labels)
        identities_list = []
        if (contact.identities_properties is not None):
            for identity_properties in contact.identities_properties:
                identity_key = identity_properties[0]
                properties = {'identity': identity_key}
                util.SetIfNotNone(properties, 'description', identity_properties[1])
                if (identity_dict[Identity.Canonicalize(identity_key)] is None):
                    user_id = None
                else:
                    user_id = identity_dict[Identity.Canonicalize(identity_key)].user_id
                util.SetIfNotNone(properties, 'user_id', user_id)
                identities_list.append(properties)
            contact_dict['identities'] = identities_list
        return contact_dict
    actual_dict = tester.SendRequest('query_contacts', user_cookie, request_dict)
    contacts = validator.QueryModelObjects(Contact, user_id, limit=request_dict.get('limit', None), start_key=request_dict.get('start_key', None))
    expected_dict = {'contacts':...