def METHOD_NAME(fname):
    """Find and parse dispatch table in implementation file `fname`."""
    cmds = []
    in_rpcs = False
    with open(fname, "r", encoding="utf8") as f:
        for line in f:
            line = line.rstrip()
            if not in_rpcs:
                if re.match("static const CRPCCommand .*\[\] =", line):
                    in_rpcs = True
            else:
                if line.startswith('};'):
                    in_rpcs = False
                elif '{' in line and '"' in line:
                    m = re.search('{ *("[^"]*"), *("[^"]*"), *&([^,]*), *{([^}]*)} *},', line)
                    assert m, 'No match to table expression: %s' % line
                    name = parse_string(m.group(2))
                    args_str = m.group(4).strip()
                    if args_str:
                        args = [RPCArgument(parse_string(x.strip()).split('|'), idx) for idx, x in enumerate(args_str.split(','))]
                    else:
                        args = []
                    cmds.append(RPCCommand(name, args))
    assert not in_rpcs and cmds, "Something went wrong with parsing the C++ file: update the regexps"
    return cmds