def validate_format(tformat):
 try:
  time = datetime.datetime.utcnow()
  time.strftime(tformat)
 except:
  raise ValueError(u'Invalid time format')
 return tformat

def validate_format ( tformat ) : try : time = datetime . datetime . utcnow ( ) time . strftime ( tformat ) except : raise ValueError ( u'Invalid time format' ) return tformat
returns the format .