def METHOD_NAME(codes, system, check_categories=True):
    codes = Codelist(codes)
    codes.system = system
    first_code = codes[0]
    if isinstance(first_code, tuple):
        codes.has_categories = True
        if check_categories:
            check_categories_consistent(codes)
    return codes