(key_records, domain, issued=None, now=None)
return _OpenRosaResponse().serializeDocument(pretty=True)
formats a list of key record documents in the xml format outlined in
    https://github.com/dimagi/commcare/wiki/CentralAuthAPI

    makes sure to set xml object properties in a standard order
    for ease of testing
formats a list of key record documents in the xml format outlined in
    https://github.com/dimagi/commcare/wiki/CentralAuthAPI
formats a list of key record documents in the xml format outlined in https : // github . com / dimagi / commcare / wiki / CentralAuthAPI
def get_mobile_auth_payload(key_records, domain, issued=None, now=None):
    """
    formats a list of key record documents in the xml format outlined in
    https://github.com/dimagi/commcare/wiki/CentralAuthAPI

    makes sure to set xml object properties in a standard order
    for ease of testing

    """
    now = now or datetime.utcnow()

    issued = issued or now

    def _OpenRosaResponse():
        x = OpenRosaResponse()
        x.auth_keys = _auth_keys()
        x.message = _('Here are your keys!')
        return x

    def _auth_keys():
        x = AuthKeys(
            key_records=list(_key_record())
        )
        x.domain = domain
        x.issued = issued
        return x

    def _key_record():
        for key_record in key_records:
            x = KeyRecord()
            for attr in ['valid', 'expires', 'uuid', 'type', 'key']:
                setattr(x, attr, getattr(key_record, attr))

            yield x

    return _OpenRosaResponse().serializeDocument(pretty=True)
def get_mobile_auth_payload ( key_records , domain , issued = None , now = None ) : now = now or datetime . utcnow ( ) issued = issued or now def _OpenRosaResponse ( ) : x = OpenRosaResponse ( ) x . auth_keys = _auth_keys ( ) x . message = _ ( 'Here are your keys!' ) return x def _auth_keys ( ) : x = AuthKeys ( key_records = list ( _key_record ( ) ) ) x . domain = domain x . issued = issued return x def _key_record ( ) : for key_record in key_records : x = KeyRecord ( ) for attr in [ 'valid' , 'expires' , 'uuid' , 'type' , 'key' ] : setattr ( x , attr , getattr ( key_record , attr ) ) yield x return _OpenRosaResponse ( ) . serializeDocument ( pretty = True )