def prepare_auth(self, auth, url='<STR_LIT>'):
<EOL>if auth is None:<EOL><INDENT>url_auth = get_auth_from_url(self.url)<EOL>auth = url_auth if any(url_auth) else None<EOL><DEDENT>if auth:<EOL><INDENT>if isinstance(auth, tuple) and len(auth) == <NUM_LIT:2>:<EOL><INDENT>auth = HTTPBasicAuth(*auth)<EOL><DEDENT>r = auth(self)<EOL>self.__dict__.update(r.__dict__)<EOL>self.prepare_content_length(self.body)<EOL><DEDENT>
Prepares the given HTTP auth data.