def _validate_quota(quota):
 if (quota is not None):
  if (not isinstance(quota, dict)):
   raise TypeError('quota must be a dictionary, provided value: {0}'.format(quota))
  periods = ['DAY', 'WEEK', 'MONTH']
  if (('period' not in quota) or (quota['period'] not in periods)):
   raise ValueError('quota must have a valid period specified, valid values are {0}'.format(','.join(periods)))
  if ('limit' not in quota):
   raise ValueError('quota limit must have a valid value')

def _validate_quota ( quota ) : if ( quota is not None ) : if ( not isinstance ( quota , dict ) ) : raise TypeError ( 'quota must be a dictionary, provided value: {0}' . format ( quota ) ) periods = [ 'DAY' , 'WEEK' , 'MONTH' ] if ( ( 'period' not in quota ) or ( quota [ 'period' ] not in periods ) ) : raise ValueError ( 'quota must have a valid period specified, valid values are {0}' . format ( ',' . join ( periods ) ) ) if ( 'limit' not in quota ) : raise ValueError ( 'quota limit must have a valid value' )
helper to verify that quota parameters are valid .