def METHOD_NAME(comedi_f):
    """
    calls a comedi function and check the return value for error
    error is considered when:
        * return code is int and < 0
        * return code is None (for pointers)
    """
    def f(*args):
        rc = comedi_f(*args)
        if rc is None or (isinstance(rc, int) and rc < 0):
            _raise_comedi_error(comedi_f.__name__, rc)
        return rc
    return f