def _lock_config_from_xml(self, xml):
    response_dict = {'enabled': False, 'mode': None, 'days': None, 'years': None}
    parsed_xml = xmltodict.parse(xml)
    enabled = (parsed_xml['ObjectLockConfiguration']['ObjectLockEnabled'] == 'Enabled')
    response_dict['enabled'] = enabled
    default_retention = parsed_xml.get('ObjectLockConfiguration').get('Rule')
    if default_retention:
        default_retention = default_retention.get('DefaultRetention')
        mode = default_retention['Mode']
        days = int(default_retention.get('Days', 0))
        years = int(default_retention.get('Years', 0))
        if (days and years):
            raise MalformedXML
        response_dict['mode'] = mode
        response_dict['days'] = days
        response_dict['years'] = years
    return response_dict
def _lock_config_from_xml(self, xml):
    response_dict = {'enabled': False, 'mode': None, 'days': None, 'years': None}
    parsed_xml = xmltodict.parse(xml)
    enabled = (parsed_xml['ObjectLockConfiguration']['ObjectLockEnabled'] == 'Enabled')
    response_dict['enabled'] = enabled
    default_retention = parsed_xml.get('ObjectLockConfiguration').get('Rule')
    if default_retention:
        default_retention = default_retention.get('DefaultRetention')
        mode = default_retention['Mode']
        days = int(default_retention.get('Days', 0))
        years = int(default_retention.get('Years', 0))
        if (days and years):
            raise MalformedXML
        response_dict['mode'] = mode
        response_dict['days'] = days
        response_dict['years'] = years
    return response_dict