def _register_handler(handler, file_formats):
if not isinstance(handler, BaseFileHandler):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>'.format(<EOL>type(handler)))<EOL><DEDENT>if isinstance(file_formats, str):<EOL><INDENT>file_formats = [file_formats]<EOL><DEDENT>if not is_list_of(file_formats, str):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>for ext in file_formats:<EOL><INDENT>file_handlers[ext] = handler<EOL><DEDENT>
Register a handler for some file extensions.

    Args:
        handler (:obj:`BaseFileHandler`): Handler to be registered.
        file_formats (str or list[str]): File formats to be handled by this
            handler.