def register_check(check, codes=None):
def _add_check(check, kind, codes, args):<EOL><INDENT>if check in _checks[kind]:<EOL><INDENT>_checks[kind][check][<NUM_LIT:0>].extend(codes or [])<EOL><DEDENT>else:<EOL><INDENT>_checks[kind][check] = (codes or ['<STR_LIT>'], args)<EOL><DEDENT><DEDENT>if inspect.isfunction(check):<EOL><INDENT>args = _get_parameters(check)<EOL>if args and args[<NUM_LIT:0>] in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if codes is None:<EOL><INDENT>codes = ERRORCODE_REGEX.findall(check.__doc__ or '<STR_LIT>')<EOL><DEDENT>_add_check(check, args[<NUM_LIT:0>], codes, args)<EOL><DEDENT><DEDENT>elif inspect.isclass(check):<EOL><INDENT>if _get_parameters(check.__init__)[:<NUM_LIT:2>] == ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>_add_check(check, '<STR_LIT>', codes, None)<EOL><DEDENT><DEDENT>
Register a new check object.