<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load(path, service=None, hostport=None, module_name=None):
 """Loads the Thrift file at the specified path. The file is compiled in-memory and a Python module containing the result is returned. It may be used with ``TChannel.thrift``. For example, .. code-block:: python from tchannel import TChannel, thrift # Load our server's interface definition. donuts = thrift.load(path='donuts.thrift') # We need to specify a service name or hostport because this is a # downstream service we'll be calling. coffee = thrift.load(path='coffee.thrift', service='coffee') tchannel = TChannel('donuts') @tchannel.thrift.register(donuts.DonutsService) @tornado.gen.coroutine def submitOrder(request):
 args = request.body if args.coffee: yield tchannel.thrift( coffee.CoffeeService.order(args.coffee) ) The returned module contains, one top-level type for each struct, enum, union, exeption, and service defined in the Thrift file. For each service, the corresponding class contains a classmethod for each function defined in that service that accepts the arguments for that function and returns a ``ThriftRequest`` capable of being sent via ``TChannel.thrift``. For more information on what gets generated by ``load``, see `thriftrw <http://thriftrw.readthedocs.org/en/latest/>`_. Note that the ``path`` accepted by ``load`` must be either an absolute path or a path relative to the *the current directory*. If you need to refer to Thrift files relative to the Python module in which ``load`` was called, use the ``__file__`` magic variable. .. code-block:: python # Given, # # foo/ # myservice.thrift # bar/ # x.py # # Inside foo/bar/x.py, path = os.path.join( os.path.dirname(__file__), '../myservice.thrift' ) The returned value is a valid Python module. You can install the module by adding it to the ``sys.modules`` dictionary. This will allow importing items from this module directly. You can use the ``__name__`` magic variable to make the generated module a submodule of the current module. For example, .. code-block:: python # foo/bar.py import sys from tchannel import thrift donuts = = thrift.load('donuts.thrift') sys.modules[__name__ + '.donuts'] = donuts This installs the module generated for ``donuts.thrift`` as the module ``foo.bar.donuts``. Callers can then import items from that module directly. For example, .. code-block:: python # foo/baz.py from foo.bar.donuts import DonutsService, Order def baz(tchannel):
 return tchannel.thrift( DonutsService.submitOrder(Order(..)) ) :param str service: Name of the service that the Thrift file represents. This name will be used to route requests through Hyperbahn. :param str path: Path to the Thrift file. If this is a relative path, it must be relative to the current directory. :param str hostport: Clients can use this to specify the hostport at which the service can be found. If omitted, TChannel will route the requests through known peers. This value is ignored by servers. :param str module_name: Name used for the generated Python module. Defaults to the name of the Thrift file. """

    # TODO replace with more specific exceptions
    # assert service, 'service is required'
    # assert path, 'path is required'

    # Backwards compatibility for callers passing in service name as first arg.
    if not path.endswith('.thrift'):
        service, path = path, service

    module = thriftrw.load(path=path, name=module_name)
    return TChannelThriftModule(service, module, hostport)