def build_payload(ipaddress,<EOL>event_type,<EOL>event_time=None,<EOL>start_time=None,<EOL>end_time=None):
<EOL>payload = {<EOL>'<STR_LIT>': str(event_type),<EOL>'<STR_LIT>': str(ipaddress.used_by_tenant_id),<EOL>'<STR_LIT>': str(ipaddress.address_readable),<EOL>'<STR_LIT>': int(ipaddress.version),<EOL>'<STR_LIT>': str(ipaddress.address_type),<EOL>'<STR_LIT:id>': str(ipaddress.id)<EOL>}<EOL>if event_type == IP_EXISTS:<EOL><INDENT>if start_time is None or end_time is None:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>.format(event_type))<EOL><DEDENT>payload.update({<EOL>'<STR_LIT>': str(convert_timestamp(start_time)),<EOL>'<STR_LIT>': str(convert_timestamp(end_time))<EOL>})<EOL><DEDENT>elif event_type in [IP_ADD, IP_DEL, IP_ASSOC, IP_DISASSOC]:<EOL><INDENT>if event_time is None:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>.format(event_type))<EOL><DEDENT>payload.update({<EOL>'<STR_LIT>': str(convert_timestamp(event_time)),<EOL>'<STR_LIT>': str(ipaddress.subnet_id),<EOL>'<STR_LIT>': str(ipaddress.network_id),<EOL>'<STR_LIT>': True if ipaddress.network_id == PUBLIC_NETWORK_ID<EOL>else False,<EOL>})<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(event_type))<EOL><DEDENT>return payload<EOL>
Method builds a payload out of the passed arguments.

    Parameters:
        `ipaddress`: the models.IPAddress object
        `event_type`: USAGE,CREATE,DELETE,SUSPEND,or UNSUSPEND
        `start_time`: startTime for cloudfeeds
        `end_time`: endTime for cloudfeeds
    Returns a dictionary suitable to notify billing.
    Message types mapping to cloud feeds for references:
        ip.exists       - USAGE
        ip.add          - CREATE
        ip.delete       - DELETE
        ip.associate    - UP
        ip.disassociate  - DOWN
    Refer to: http://rax.io/cf-api for more details.