def METHOD_NAME(event, context):
    """
  Main entry point of the Cloud Function. Will extract the subnet information
  from the PubSub event, and enable VPC flow logs if needed.
  """
    if not 'data' in event:
        logging.error('no data found. Ignoring event.')
        return
    pubsub_message = base64.b64decode(event['data']).decode('utf-8')
    json_msg = None
    try:
        json_msg = json.loads(pubsub_message)
    except ValueError:  # includes simplejson.decoder.JSONDecodeError
        logging.error('invalid pubsub message: %s', pubsub_message)
        return
    subnet = parse_payload(json_msg)
    if context is not None and too_old(context):
        logging.error('ignoring subnet change. Too old.')
        return
    if not subnet:
        return
    logging.info('subnet ID: /projects/%s/regions/%s/subnetworks/%s.',
                 subnet['project'], subnet['region'], subnet['subnetwork'])
    enable_flow_logs(subnet['project'], subnet['region'], subnet['subnetwork'])