def from_xml(self, xml_string):
        """Grab errors from an XML response.

        Args:
            xml_string: An xml errors object (e.g. '<errors></errors>')
        Returns:
            None
        """
        attribute_keys = self.base.attributes.keys()
        try:
            messages = util.xml_to_dict(
                    xml_string)['errors']['error']
            if not isinstance(messages, list):
                messages = [messages]
        except util.Error:
            messages = []
        for message in messages:
            attr_name = message.split()[0]
            key = util.underscore(attr_name)
            if key in attribute_keys:
                self.add(key, message[len(attr_name)+1:])
            else:
                self.add_to_base(message)
dataset/ETHPy150Open JetBrains/youtrack-rest-python-library/python/pyactiveresource/activeresource.py/Errors.from_xml/original