def parse_nested(
    bels: list, char_locs: CharLocs, parsed: Parsed, errors: Errors
) -> Tuple[Parsed, Errors]:
    """ Parse nested BEL object """

    for sp in char_locs[
        "nested_parens"
    ]:  # sp = start parenthesis, ep = end parenthesis
        ep, level = char_locs["nested_parens"][sp]
        if ep == -1:
            ep = len(bels) + 1
        parsed[(sp, ep)] = {"type": "Nested", "span": (sp, ep)}

    return parsed, errors
Parse nested BEL object