code: def check_legality(fn):
      @wraps(fn)
      def wrap(every=None, once=None, filter_fn=None):
          if (every is None) and (once is None) and (filter_fn is None):
              every = 1
  
          if not (
              (every is not None)
              ^ (once is not None)
              ^ (filter_fn is not None)
          ):
              raise ValueError(
                  "These three values should be only set one."
              )
  
          if (filter_fn is not None) and not callable(filter_fn):
              raise TypeError("Argument filter_fn should be a callable")
  
          if (every is not None) and not (
              isinstance(every, int) and every > 0
          ):
              raise ValueError(
                  "Argument every should be integer and greater than zero"
              )
  
          if (once is not None) and not (
              isinstance(once, int) and once > 0
          ):
              raise ValueError(
                  "Argument once should be integer and positive"
              )
          return fn(every=every, once=once, filter_fn=filter_fn)
  
      return wrap
  
imports: from typing import Optional, Callable, Dict
  from functools import wraps
label_desc: Use image node_id 1 for calling a global function with example usage: check_legality(fn) and returns: wrap, fn