def METHOD_NAME(self, file, fp, default_netrc):
    lexer = shlex.shlex(fp)
    lexer.wordchars += r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
    lexer.commenters = lexer.commenters.replace('#', '')
    while 1:
        # Look for a machine, default, or macdef top-level keyword
        toplevel = tt = lexer.get_token()
        if not tt:
            break
        elif tt[0] == '#':
            # seek to beginning of comment, in case reading the token put
            # us on a new line, and then skip the rest of the line.
            pos = len(tt) + 1
            lexer.instream.seek(-pos, 1)
            lexer.instream.readline()
            continue
        elif tt == 'machine':
            entryname = lexer.get_token()
        elif tt == 'default':
            entryname = 'default'
        elif tt == 'macdef':                # Just skip to end of macdefs
            entryname = lexer.get_token()
            self.macros[entryname] = []
            lexer.whitespace = ' \t'
            while 1:
                line = lexer.instream.readline()
                if not line or line == '\012':
                    lexer.whitespace = ' \t\r\n'
                    break
                self.macros[entryname].append(line)
            continue
        else:
            raise NetrcParseError(
                "bad toplevel token %r" % tt, file, lexer.lineno)
        # We're looking at start of an entry for a named machine or default.
        login = ''
        account = password = None
        self.hosts[entryname] = {}
        while 1:
            tt = lexer.get_token()
            if (tt.startswith('#') or
                tt in {'', 'machine', 'default', 'macdef'}):
                if password:
                    self.hosts[entryname] = (login, account, password)
                    lexer.push_token(tt)
                    break
                else:
                    raise NetrcParseError(
                        "malformed %s entry %s terminated by %s"
                        % (toplevel, entryname, repr(tt)),
                        file, lexer.lineno)
            elif tt == 'login' or tt == 'user':
                login = lexer.get_token()
            elif tt == 'account':
                account = lexer.get_token()
            elif tt == 'password':
                if os.name == 'posix' and default_netrc:
                    prop = os.fstat(fp.fileno())
                    if prop.st_uid != os.getuid():
                        try:
                            fowner = pwd.getpwuid(prop.st_uid)[0]
                        except KeyError:
                            fowner = 'uid %s' % prop.st_uid
                        try:
                            user = pwd.getpwuid(os.getuid())[0]
                        except KeyError:
                            user = 'uid %s' % os.getuid()
                        raise NetrcParseError(
                            ("~/.netrc file owner (%s) does not match"
                             " current user (%s)") % (fowner, user),
                            file, lexer.lineno)
                    if (prop.st_mode & (stat.S_IRWXG | stat.S_IRWXO)):
                        raise NetrcParseError(
                           "~/.netrc access too permissive: access"
                           " permissions must restrict access to only"
                           " the owner", file, lexer.lineno)
                password = lexer.get_token()
            else:
                raise NetrcParseError("bad follower token %r" % tt,
                                      file, lexer.lineno)