def METHOD_NAME(cls, code: int, function: Optional[str] = None) -> None:
    """Checks the error code and raises an exception, if necessary
    If the error code is in ``SUCCESS_CODES``, no exception is raises. Same applies if the code
    is contained in ``WARNING_CODES``. Then, a warning is generated. If neither of both is the
    case, an exception is generated based on the error code.
    Args:
        code: Occurred error code
        function: Dll-function that returned the error code
    Raises:
        If code is not in ``SUCCESS_CODES`` or ``WARNING_CODES``, an ANC350LibError is raised
    """
    if code not in cls.SUCCESS_CODES:
        if function:
            function = "In function " + function
        if code in cls.WARNING_CODES:
            warnings.warn(cls._process_code_message(code, function))
        else:
            raise cls(function, code)