def check_partitioners(partitioners, keys):
 if (partitioners is None):
  return {}
 keys = set(keys)
 if (not (set(partitioners) <= keys)):
  extra_keys = (set(partitioners) - keys)
  raise KeyError('Invalid partitioner keys {}, partitioners can only be provided for {}'.format(', '.join(("'{}'".format(key) for key in extra_keys)), ', '.join(("'{}'".format(key) for key in keys))))
 def check_nested_callables(dictionary):
  for (key, entry) in dictionary.iteritems():
   if isinstance(entry, dict):
    check_nested_callables(entry)
   elif (not callable(entry)):
    raise TypeError("Partitioner for '{}' is not a callable function or dictionary".format(key))
 check_nested_callables(partitioners)
 return partitioners

def check_partitioners ( partitioners , keys ) : if ( partitioners is None ) : return { } keys = set ( keys ) if ( not ( set ( partitioners ) <= keys ) ) : extra_keys = ( set ( partitioners ) - keys ) raise KeyError ( 'Invalid partitioner keys {}, partitioners can only be provided for {}' . format ( ', ' . join ( ( "'{}'" . format ( key ) for key in extra_keys ) ) , ', ' . join ( ( "'{}'" . format ( key ) for key in keys ) ) ) ) def check_nested_callables ( dictionary ) : for ( key , entry ) in dictionary . iteritems ( ) : if isinstance ( entry , dict ) : check_nested_callables ( entry ) elif ( not callable ( entry ) ) : raise TypeError ( "Partitioner for '{}' is not a callable function or dictionary" . format ( key ) ) check_nested_callables ( partitioners ) return partitioners
checks the given partitioners .