original_docstring: 
          Reads one object, determining the reader method to use based on the
          tag name of the first element. For example, if the first tag name
          is `vm` then it will create a `Vm` object, if it the tag is `vms`
          it will create an array of `Vm` objects, so on.
  
          :param source: The string, IO or XML reader where the input will be taken from.
          
docstring: Reads one object, determining the reader method to use based on the
  tag name of the first element.
docstring_tokens: Reads one object determining the reader method to use based on the tag name of the first element .
code: def read(cls, source):
          """
          Reads one object, determining the reader method to use based on the
          tag name of the first element. For example, if the first tag name
          is `vm` then it will create a `Vm` object, if it the tag is `vms`
          it will create an array of `Vm` objects, so on.
  
          :param source: The string, IO or XML reader where the input will be taken from.
          """
          # If the source is a string or IO object then create a XML reader from it:
          cursor = None
          if isinstance(source, str):
              # In Python 3 str is a list of 16 bits characters, so it
              # needs to be converted to an array of bytes, using UTF-8,
              # before trying to parse it.
              if six.PY3:
                  source = source.encode('utf-8')
              cursor = xml.XmlReader(io.BytesIO(source))
          elif isinstance(source, bytes):
              cursor = xml.XmlReader(io.BytesIO(source))
          elif isinstance(source, io.BytesIO):
              cursor = xml.XmlReader(source)
          elif isinstance(source, xml.XmlReader):
              cursor = source
          else:
              raise AttributeError(
                  "Expected a 'str', 'BytesIO' or 'XmlReader', but got '{source}'".format(
                      source=type(source)
                  )
              )
  
          try:
              # Do nothing if there aren't more tags:
              if not cursor.forward():
                  return None
  
              # Select the specific reader according to the tag:
              tag = cursor.node_name()
              reader = cls._readers.get(tag)
              if reader is None:
                  raise Error(
                      "Can't find a reader for tag '{tag}'".format(tag=tag)
                  )
  
              # Read the object using the specific reader:
              return reader(cursor)
          finally:
              if cursor is not None and cursor != source:
                  cursor.close()
code_tokens: def read ( cls , source ) : cursor = None if isinstance ( source , str ) : if six . PY3 : source = source . encode ( 'utf-8' ) cursor = xml . XmlReader ( io . BytesIO ( source ) ) elif isinstance ( source , bytes ) : cursor = xml . XmlReader ( io . BytesIO ( source ) ) elif isinstance ( source , io . BytesIO ) : cursor = xml . XmlReader ( source ) elif isinstance ( source , xml . XmlReader ) : cursor = source else : raise AttributeError ( "Expected a 'str', 'BytesIO' or 'XmlReader', but got '{source}'" . format ( source = type ( source ) ) ) try : if not cursor . forward ( ) : return None tag = cursor . node_name ( ) reader = cls . _readers . get ( tag ) if reader is None : raise Error ( "Can't find a reader for tag '{tag}'" . format ( tag = tag ) ) return reader ( cursor ) finally : if cursor is not None and cursor != source : cursor . close ( )
short_docstring: Reads one object, determining the reader method to use based on the
  tag name of the first element.
short_docstring_tokens: Reads one object determining the reader method to use based on the tag name of the first element .
comment: """
          Reads one object, determining the reader method to use based on the
          tag name of the first element. For example, if the first tag name
          is `vm` then it will create a `Vm` object, if it the tag is `vms`
          it will create an array of `Vm` objects, so on.
  
          :param source: The string, IO or XML reader where the input will be taken from.
          """$SEP$# If the source is a string or IO object then create a XML reader from it:$SEP$# In Python 3 str is a list of 16 bits characters, so it$SEP$# needs to be converted to an array of bytes, using UTF-8,$SEP$# before trying to parse it.$SEP$# Do nothing if there aren't more tags:$SEP$# Select the specific reader according to the tag:$SEP$# Read the object using the specific reader: