def keep_lazy(*resultclasses):
 if (not resultclasses):
  raise TypeError('You must pass at least one argument to keep_lazy().')
 def decorator(func):
  lazy_func = lazy(func, *resultclasses)
  @wraps(func)
  def wrapper(*args, **kwargs):
   for arg in (list(args) + list(kwargs.values())):
    if isinstance(arg, Promise):
     break
   else:
    return func(*args, **kwargs)
   return lazy_func(*args, **kwargs)
  return wrapper
 return decorator

def keep_lazy ( * resultclasses ) : if ( not resultclasses ) : raise TypeError ( 'You must pass at least one argument to keep_lazy().' ) def decorator ( func ) : lazy_func = lazy ( func , * resultclasses ) @ wraps ( func ) def wrapper ( * args , ** kwargs ) : for arg in ( list ( args ) + list ( kwargs . values ( ) ) ) : if isinstance ( arg , Promise ) : break else : return func ( * args , ** kwargs ) return lazy_func ( * args , ** kwargs ) return wrapper return decorator
a decorator that allows a function to be called with one or more lazy arguments .