<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __build_cmd_maps(cls):
 """Build the mapping from command names to method names. One command name maps to at most one method. Multiple command names can map to the same method. Only used by __init__() to initialize self._cmd_map. MUST NOT be used elsewhere. Returns: A tuple (cmd_map, hidden_cmd_map, internal_cmd_map). """

        cmd_map_all = {}
        cmd_map_visible = {}
        cmd_map_internal = {}
        for name in dir(cls):
            obj = getattr(cls, name)
            if iscommand(obj):
                for cmd in getcommands(obj):
                    if cmd in cmd_map_all.keys():
                        raise PyShellError("The command '{}' already has cmd"
                                           " method '{}', cannot register a"
                                           " second method '{}'.".format( \
                                                    cmd, cmd_map_all[cmd], obj.__name__))
                    cmd_map_all[cmd] = obj.__name__
                    if isvisiblecommand(obj):
                        cmd_map_visible[cmd] = obj.__name__
                    if isinternalcommand(obj):
                        cmd_map_internal[cmd] = obj.__name__
        return cmd_map_all, cmd_map_visible, cmd_map_internal