def add_handlers(self, namespace):
if isinstance(namespace, str):<EOL><INDENT>namespace = import_module(namespace)<EOL><DEDENT>if isinstance(namespace, dict):<EOL><INDENT>namespace = namespace.items()<EOL><DEDENT>else:<EOL><INDENT>namespace = vars(namespace).items()<EOL><DEDENT>for name, value in namespace:<EOL><INDENT>if name.startswith('<STR_LIT:_>'):<EOL><INDENT>continue<EOL><DEDENT>if isfunction(value) or ismethod(value):<EOL><INDENT>self.handlers[name] = value<EOL><DEDENT><DEDENT>
Add handler functions from the given `namespace`, for instance a module.

The namespace may be a string, in which case it is expected to be a name of a module.
It may also be a dictionary mapping names to functions.

Only non-underscore-prefixed functions and methods are imported.

:param namespace: Namespace object.
:type namespace: str|module|dict[str, function]