def _parse_cell_type_mapping(mapping):
 if (mapping is None):
  return None
 results = {}
 for entry in mapping.split(','):
  if (':' not in entry):
   raise stem.ProtocolError(("Mappings are expected to be of the form 'key:value', got '%s': %s" % (entry, mapping)))
  (key, value) = entry.split(':', 1)
  if (not CELL_TYPE.match(key)):
   raise stem.ProtocolError(("Key had invalid characters, got '%s': %s" % (key, mapping)))
  elif (not value.isdigit()):
   raise stem.ProtocolError(("Values should just be integers, got '%s': %s" % (value, mapping)))
  results[key] = int(value)
 return results

def _parse_cell_type_mapping ( mapping ) : if ( mapping is None ) : return None results = { } for entry in mapping . split ( ',' ) : if ( ':' not in entry ) : raise stem . ProtocolError ( ( "Mappings are expected to be of the form 'key:value', got '%s': %s" % ( entry , mapping ) ) ) ( key , value ) = entry . split ( ':' , 1 ) if ( not CELL_TYPE . match ( key ) ) : raise stem . ProtocolError ( ( "Key had invalid characters, got '%s': %s" % ( key , mapping ) ) ) elif ( not value . isdigit ( ) ) : raise stem . ProtocolError ( ( "Values should just be integers, got '%s': %s" % ( value , mapping ) ) ) results [ key ] = int ( value ) return results
parses a mapping of the form .