<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parser(format_name, ext_names=None):
 """ Decorate a parser class to register it. :param format_name: standard format name :param ext_names: supported extension name """


    def decorator(cls):
        format_name_lower = format_name.lower()
        if ext_names is None:
            _ext_format_mapping[format_name_lower] = format_name_lower
        else:
            for ext in to_list(ext_names):
                _ext_format_mapping[ext.lower()] = format_name_lower
        _format_parser_mapping[format_name_lower] = cls()
        return cls

    return decorator