<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def arg_types(parsed: Parsed, errors: Errors) -> Tuple[Parsed, Errors]: """Add argument types to parsed function data structure Args: parsed: function and arg locations in BEL string errors: error messages Returns: (parsed, errors):
 parsed, arguments with arg types plus error messages """


    func_pattern = re.compile(r"\s*[a-zA-Z]+\(")
    nsarg_pattern = re.compile(r"^\s*([A-Z]+):(.*?)\s*$")

    for span in parsed:
        if parsed[span]["type"] != "Function" or "parens_span" not in parsed[span]:
            continue

        for i, arg in enumerate(parsed[span]["args"]):
            nsarg_matches = nsarg_pattern.match(arg["arg"])
            if func_pattern.match(arg["arg"]):
                parsed[span]["args"][i].update({"type": "Function"})
            elif nsarg_matches:
                (start, end) = arg["span"]
                ns = nsarg_matches.group(1)
                ns_val = nsarg_matches.group(2)
                ns_span = nsarg_matches.span(1)
                ns_span = (ns_span[0] + start, ns_span[1] + start - 1)
                ns_val_span = nsarg_matches.span(2)
                ns_val_span = (ns_val_span[0] + start, ns_val_span[1] + start - 1)

                parsed[span]["args"][i].update(
                    {
                        "type": "NSArg",
                        "ns": ns,
                        "ns_span": ns_span,
                        "ns_val": ns_val,
                        "ns_val_span": ns_val_span,
                    }
                )
            else:
                parsed[span]["args"][i].update({"type": "StrArg"})

    return parsed, errors