def METHOD_NAME(json_msg):
    """
  Extract the subnet information from the json payload.
  """
    project = region = subnetwork = None
    # Stackdriver change notification
    if 'resource' in json_msg and 'type' in json_msg['resource'] and json_msg[
            'resource']['type'] == 'gce_subnetwork':
        project = json_msg['resource']['labels']['project_id']
        region = json_msg['resource']['labels']['location']
        subnetwork = json_msg['resource']['labels']['subnetwork_name']
        logging.info('got subnet change notification from Cloud Logging')
    # Cloud Asset Inventory change notification
    elif 'asset' in json_msg and 'assetType' in json_msg['asset'] and \
            json_msg['asset']['assetType'] == \
    'compute.googleapis.com/Subnetwork':
        logging.info(
            'got subnet change notification from Cloud Asset Inventory')
        if 'resource' in json_msg['asset'] and \
                'data' in json_msg['asset']['resource']:
            if 'enableFlowLogs' in json_msg['asset']['resource']['data']:
                if json_msg['asset']['resource']['data']['enableFlowLogs']:
                    logging.info('log config already enabled in %s.',
                                 (json_msg['asset']['name']))
                    return None
            # extract the subnet id from the asset name
            for elem in ['project', 'region', 'subnetwork']:
                m = re.search(r'/%s/([^/]+)' % (elem + 's'),
                              json_msg['asset']['name'])
                if m:
                    if elem == 'project':
                        project = m.group(1)
                    elif elem == 'region':
                        region = m.group(1)
                    elif elem == 'subnetwork':
                        subnetwork = m.group(1)
    else:
        logging.error('event type is not gce_subnetwork. Ignoring event: %s',
                      (str(json_msg)))
        return None
    return {'project': project, 'region': region, 'subnetwork': subnetwork}