def contains_one_of(*fields):
 message = 'Must contain any one of the following fields: {0}'.format(', '.join(fields))
 def check_contains(endpoint_fields):
  for field in fields:
   if (field in endpoint_fields):
    return
  errors = {}
  for field in fields:
   errors[field] = 'one of these must have a value'
  return errors
 check_contains.__doc__ = message
 return check_contains

def contains_one_of ( * fields ) : message = 'Must contain any one of the following fields: {0}' . format ( ', ' . join ( fields ) ) def check_contains ( endpoint_fields ) : for field in fields : if ( field in endpoint_fields ) : return errors = { } for field in fields : errors [ field ] = 'one of these must have a value' return errors check_contains . __doc__ = message return check_contains
enables ensuring that one of multiple optional fields is set .