'Return a dictionary mapping parameters to defaults
(whitespace-normalized strings).'

def function_parameters(self, lineno):

    self.goto_line(lineno)
    while (self.string != 'def'):
        self.next()
    while (self.string != '('):
        self.next()
    name = None
    default = None
    parameter_tuple = None
    self.tokens = []
    parameters = {}
    self.stack = [self.string]
    self.next()
    while 1:
        if (len(self.stack) == 1):
            if parameter_tuple:
                name = ''.join(self.tokens).strip()
                self.tokens = []
                parameter_tuple = None
            if (self.string in (')', ',')):
                if name:
                    if self.tokens:
                        default_text = ''.join(self.tokens).strip()
                    else:
                        default_text = None
                    parameters[name] = default_text
                    self.tokens = []
                    name = None
                    default = None
                if (self.string == ')'):
                    break
            elif (self.type == token.NAME):
                if (name and default):
                    self.note_token()
                else:
                    assert (name is None), ('token=%r    name=%r    parameters=%r    stack=%r' % (self.token, name, parameters, self.stack))
                    name = self.string
            elif (self.string == '='):
                assert (name is not None), ('token=%r' % (self.token,))
                assert (default is None), ('token=%r' % (self.token,))
                assert (self.tokens == []), ('token=%r' % (self.token,))
                default = 1
                self._type = None
                self._string = None
                self._backquote = 0
            elif name:
                self.note_token()
            elif (self.string == '('):
                parameter_tuple = 1
                self._type = None
                self._string = None
                self._backquote = 0
                self.note_token()
            else:
                assert ((self.string in ('*', '**', '\n')) or (self.type == tokenize.COMMENT)), ('token=%r' % (self.token,))
        else:
            self.note_token()
        self.next()
    return parameters
