<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_argspec(argspec):
 """ retrieve a FunctionSignature object from the argspec and the annotations passed. """

        attributes = getattr(argspec, "args", []) + getattr(argspec, "keywords", [])
        defaults = argspec.defaults or []

        arguments, keywords = [], {}

        attribute_list = (
            attributes[: -len(defaults)] if len(defaults) != 0 else attributes[:]
        )
        for name in attribute_list:
            if name == "self":
                continue
            typ = argspec.annotations.get(name)
            arguments.append(Argument(name, NoDefault, typ))

        if len(defaults) != 0:
            for name, default in zip(attributes[-len(defaults) :], defaults):
                typ = argspec.annotations.get(name)
                keywords[name] = Argument(name, default, typ)

        return FunctionSignature(arguments, keywords)