'If the tool shed is using external auth, the client to the tool shed must authenticate to that
as well.  This provides access to the six.moves.urllib.request.HTTPPasswordMgrWithdefaultRealm() object for the
url passed in.
Following more what galaxy.demo_sequencer.controllers.common does might be more appropriate at
some stage...'

def password_manager_for_url(self, url):

    url_sans_protocol = common_util.remove_protocol_from_tool_shed_url(url)
    for (shed_name, shed_url) in self.tool_sheds.items():
        shed_url_sans_protocol = common_util.remove_protocol_from_tool_shed_url(shed_url)
        if url_sans_protocol.startswith(shed_url_sans_protocol):
            return self.tool_sheds_auth[shed_name]
    log.debug(("Invalid    url    '%s'    received    by    tool    shed    registry's    password_manager_for_url    method." % str(url)))
    return None
