def _logging_from_xml(self, xml):
    parsed_xml = xmltodict.parse(xml)
    if (not parsed_xml['BucketLoggingStatus'].get('LoggingEnabled')):
        return {}
    if (not parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetBucket')):
        raise MalformedXML()
    if (not parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetPrefix')):
        parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetPrefix'] = ''
    if parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetGrants'):
        permissions = ['READ', 'WRITE', 'FULL_CONTROL']
        if (not isinstance(parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant'], list)):
            target_grants = self._get_grants_from_xml([parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant']], MalformedXML, permissions)
        else:
            target_grants = self._get_grants_from_xml(parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant'], MalformedXML, permissions)
        parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants'] = target_grants
    return parsed_xml['BucketLoggingStatus']['LoggingEnabled']
def _logging_from_xml(self, xml):
    parsed_xml = xmltodict.parse(xml)
    if (not parsed_xml['BucketLoggingStatus'].get('LoggingEnabled')):
        return {}
    if (not parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetBucket')):
        raise MalformedXML()
    if (not parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetPrefix')):
        parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetPrefix'] = 
    if parsed_xml['BucketLoggingStatus']['LoggingEnabled'].get('TargetGrants'):
        permissions = ['READ', 'WRITE', 'FULL_CONTROL']
        if (not isinstance(parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant'], list)):
            target_grants = self._get_grants_from_xml([parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant']], MalformedXML, permissions)
        else:
            target_grants = self._get_grants_from_xml(parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants']['Grant'], MalformedXML, permissions)
        parsed_xml['BucketLoggingStatus']['LoggingEnabled']['TargetGrants'] = target_grants
    return parsed_xml['BucketLoggingStatus']['LoggingEnabled']