def annotate(**kwargs):
 if (not kwargs):
  raise ValueError('annotations must be provided as keyword arguments')
 def dec(f):
  if hasattr(f, '__annotations__'):
   for (k, v) in kwargs.items():
    f.__annotations__[k] = v
  else:
   f.__annotations__ = kwargs
  return f
 return dec

def annotate ( ** kwargs ) : if ( not kwargs ) : raise ValueError ( 'annotations must be provided as keyword arguments' ) def dec ( f ) : if hasattr ( f , '__annotations__' ) : for ( k , v ) in kwargs . items ( ) : f . __annotations__ [ k ] = v else : f . __annotations__ = kwargs return f return dec
python 3 compatible function annotation for python 2 .