def from_key_val_list(value):
 if (value is None):
  return None
 if isinstance(value, (str, bytes, bool, int)):
  raise ValueError('cannot encode objects that are not 2-tuples')
 return OrderedDict(value)

def from_key_val_list ( value ) : if ( value is None ) : return None if isinstance ( value , ( str , bytes , bool , int ) ) : raise ValueError ( 'cannot encode objects that are not 2-tuples' ) return OrderedDict ( value )
take an object and test to see if it can be represented as a dictionary .