code: def add_function(self, completeness=False, **fields):
          
          def dec(fn):
              if completeness:
                  def fn_with_config_and_c(
                          catalogue, config, completeness_table=None):
                      return fn(catalogue, completeness_table, **config)
                  fn_with_config = fn_with_config_and_c
              else:
                  def fn_with_config_without_c(catalogue, config):
                      return fn(catalogue, **config)
                  fn_with_config = fn_with_config_without_c
              fn_with_config.fields = fields
              fn_with_config.completeness = completeness
              fn.fields = fields
              self[fn.__name__] = fn_with_config
              return fn
          return dec
docs: Function decorator.
  
          Decorate a function by adding a call to `set_defaults` and
          `check_config`. Then, save into the registry a callable
          function with the same signature of the original method
  
          :param fields:
              a dictionary of field spec, e.g.
              time_bin=numpy.float,
              b_value=1E-6