def custom_model(*args, **kwargs):
 fit_deriv = kwargs.get(u'fit_deriv', None)
 if ((len(args) == 1) and six.callable(args[0])):
  return _custom_model_wrapper(args[0], fit_deriv=fit_deriv)
 elif (not args):
  return functools.partial(_custom_model_wrapper, fit_deriv=fit_deriv)
 else:
  raise TypeError(u'{0} takes at most one positional argument (the callable/function to be turned into a model.  When used as a decorator it should be passed keyword arguments only (if any).'.format(__name__))

def custom_model ( * args , ** kwargs ) : fit_deriv = kwargs . get ( u'fit_deriv' , None ) if ( ( len ( args ) == 1 ) and six . callable ( args [ 0 ] ) ) : return _custom_model_wrapper ( args [ 0 ] , fit_deriv = fit_deriv ) elif ( not args ) : return functools . partial ( _custom_model_wrapper , fit_deriv = fit_deriv ) else : raise TypeError ( u'{0} takes at most one positional argument (the callable/function to be turned into a model.  When used as a decorator it should be passed keyword arguments only (if any).' . format ( __name__ ) )
create a model from a user defined function .