def maybe_signature(d, app=None, clone=False):
 if (d is not None):
  if isinstance(d, abstract.CallableSignature):
   if clone:
    d = d.clone()
  elif isinstance(d, dict):
   d = signature(d)
  if (app is not None):
   d._app = app
 return d

def maybe_signature ( d , app = None , clone = False ) : if ( d is not None ) : if isinstance ( d , abstract . CallableSignature ) : if clone : d = d . clone ( ) elif isinstance ( d , dict ) : d = signature ( d ) if ( app is not None ) : d . _app = app return d
ensure obj is a signature .