def _get_auth_from_netrc(self, hostname):
try:<EOL><INDENT>hostauth = netrc(self.NETRC_FILE)<EOL><DEDENT>except IOError as cause:<EOL><INDENT>if cause.errno != errno.ENOENT:<EOL><INDENT>raise<EOL><DEDENT>return None<EOL><DEDENT>except NetrcParseError as cause:<EOL><INDENT>raise  <EOL><DEDENT>auth = hostauth.hosts.get('<STR_LIT>'.format(self.user or getpass.getuser(), hostname), None)<EOL>if not auth:<EOL><INDENT>auth = hostauth.hosts.get(hostname, None)<EOL><DEDENT>if auth:<EOL><INDENT>username, account, password = auth  <EOL>if username:<EOL><INDENT>self.user = username<EOL><DEDENT>if password == '<STR_LIT>':<EOL><INDENT>self.password = account.decode('<STR_LIT>')<EOL><DEDENT>elif password:<EOL><INDENT>self.password = password<EOL><DEDENT><DEDENT>return '<STR_LIT>'<EOL>
Try to find login auth in ``~/.netrc``.