code: def parse(cls, element):
          
          if element.tag != cls.AGENT_TAG:
              raise exceptions.ParseError(
                  u"Agent got unexpected tag {}; expected {}".format(
                      element.tag, cls.AGENT_TAG
                  )
              )
  
          role = element.get(u"ROLE")
          if not role:
              raise exceptions.ParseError(u"Agent must have a ROLE attribute.")
          if role == u"OTHER":
              role = element.get(u"OTHERROLE") or role
          agent_type = element.get(u"TYPE")
          if agent_type == u"OTHER":
              agent_type = element.get(u"OTHERTYPE") or agent_type
          agent_id = element.get(u"ID")
          try:
              name = element.find(cls.NAME_TAG).text
          except AttributeError:
              name = None
          notes = [note.text for note in element.findall(cls.NOTE_TAG)]
  
          return cls(role, id=agent_id, type=agent_type, name=name, notes=notes)
docs: Create a new Agent by parsing root.
  
          :param element: Element to be parsed into an Agent.
          :raises exceptions.ParseError: If element is not a valid agent.