def _get_grants_from_xml(self, grant_list, exception_type, permissions):
    grants = []
    for grant in grant_list:
        if (grant.get('Permission', '') not in permissions):
            raise exception_type()
        if (grant['Grantee'].get('@xsi:type', '') not in ['CanonicalUser', 'AmazonCustomerByEmail', 'Group']):
            raise exception_type()
        grants.append(FakeGrant([FakeGrantee(id=grant['Grantee'].get('ID', ''), display_name=grant['Grantee'].get('DisplayName', ''), uri=grant['Grantee'].get('URI', ''))], [grant['Permission']]))
    return grants
def _get_grants_from_xml(self, grant_list, exception_type, permissions):
    grants = []
    for grant in grant_list:
        if (grant.get('Permission', ) not in permissions):
            raise exception_type()
        if (grant['Grantee'].get('@xsi:type', ) not in ['CanonicalUser', 'AmazonCustomerByEmail', 'Group']):
            raise exception_type()
        grants.append(FakeGrant([FakeGrantee(id=grant['Grantee'].get('ID', ), display_name=grant['Grantee'].get('DisplayName', ), uri=grant['Grantee'].get('URI', ))], [grant['Permission']]))
    return grants