<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def agent(server="http://localhost:8000"):
 """Run in agent mode. This gathers data, and sends it to a server given by the server argument. """

    import xmlrpc.client
    sp = xmlrpc.client.ServerProxy(server)
    hw = getallhwinfo()
    fields = header_fields()
    for f in fields:
        if not f in hw:
            hw[f] = ''
    try:
        sp.puthwinfo(xmlrpc.client.dumps((hw,)))
    except xmlrpc.client.Error as v:
        print("ERROR occured: ", v)