<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assemble_url( endpoint: str, remote_connection: 'environ.RemoteConnection' = None ) -> str: """ Assembles a fully-resolved remote connection URL from the given endpoint and remote_connection structure. If the remote_connection is omitted, the global remote_connection object stored in the environ module will be used in its place. :param endpoint: The endpoint for the API call :param remote_connection: The remote connection definition data structure :return: The fully-resolved URL for the given endpoint """

    url_root = (
        remote_connection.url
        if remote_connection else
        environ.remote_connection.url
    )
    url_root = url_root if url_root else 'localhost:5010'

    parts = [
        'http://' if not url_root.startswith('http') else '',
        url_root.rstrip('/'),
        '/',
        endpoint.lstrip('/')
    ]

    return ''.join(parts)