<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract_locals(trcback):
 """ Extracts the frames locals of given traceback. :param trcback: Traceback. :type trcback: Traceback :return: Frames locals. :rtype: list """


    output = []
    stack = extract_stack(get_inner_most_frame(trcback))
    for frame, file_name, line_number, name, context, index in stack:
        args_names, nameless, keyword = extract_arguments(frame)
        arguments, nameless_args, keyword_args, locals = OrderedDict(), [], {}, {}
        for key, data in frame.f_locals.iteritems():
            if key == nameless:
                nameless_args = map(repr, frame.f_locals.get(nameless, ()))
            elif key == keyword:
                keyword_args = dict((arg, repr(value)) for arg, value in frame.f_locals.get(keyword, {}).iteritems())
            elif key in args_names:
                arguments[key] = repr(data)
            else:
                locals[key] = repr(data)
        output.append(((name, file_name, line_number), (arguments, nameless_args, keyword_args, locals)))
    return output