'Prepares the given HTTP auth data.'

def prepare_auth(self, auth, url=''):

    if (auth is None):
        url_auth = get_auth_from_url(self.url)
        auth = (url_auth if any(url_auth) else None)
    if auth:
        if (isinstance(auth, tuple) and (len(auth) == 2)):
            auth = HTTPBasicAuth(*auth)
        r = auth(self)
        self.__dict__.update(r.__dict__)
        self.prepare_content_length(self.body)
