def _acl_from_xml(self, xml):
    parsed_xml = xmltodict.parse(xml)
    if (not parsed_xml.get('AccessControlPolicy')):
        raise MalformedACLError()
    if (not parsed_xml['AccessControlPolicy'].get('Owner')):
        raise MalformedACLError()
    if (parsed_xml['AccessControlPolicy'].get('AccessControlList') is None):
        return []
    if (not parsed_xml['AccessControlPolicy']['AccessControlList'].get('Grant')):
        raise MalformedACLError()
    permissions = ['READ', 'WRITE', 'READ_ACP', 'WRITE_ACP', 'FULL_CONTROL']
    if (not isinstance(parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'], list)):
        parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'] = [parsed_xml['AccessControlPolicy']['AccessControlList']['Grant']]
    grants = self._get_grants_from_xml(parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'], MalformedACLError, permissions)
    return FakeAcl(grants)
def _acl_from_xml(self, xml):
    parsed_xml = xmltodict.parse(xml)
    if (not parsed_xml.get('AccessControlPolicy')):
        raise MalformedACLError()
    if (not parsed_xml['AccessControlPolicy'].get('Owner')):
        raise MalformedACLError()
    if (parsed_xml['AccessControlPolicy'].get('AccessControlList') is None):
        return []
    if (not parsed_xml['AccessControlPolicy']['AccessControlList'].get('Grant')):
        raise MalformedACLError()
    permissions = ['READ', 'WRITE', 'READ_ACP', 'WRITE_ACP', 'FULL_CONTROL']
    if (not isinstance(parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'], list)):
        parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'] = [parsed_xml['AccessControlPolicy']['AccessControlList']['Grant']]
    grants = self._get_grants_from_xml(parsed_xml['AccessControlPolicy']['AccessControlList']['Grant'], MalformedACLError, permissions)
    return FakeAcl(grants)