<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lookup_endpoint(cli):
 """Looks up the application endpoint from dotcloud"""

    url = '/applications/{0}/environment'.format(APPNAME)
    environ = cli.user.get(url).item
    port = environ['DOTCLOUD_SATELLITE_ZMQ_PORT']
    host = socket.gethostbyname(environ['DOTCLOUD_SATELLITE_ZMQ_HOST'])
    return "tcp://{0}:{1}".format(host, port)