class_docstr: Class which performs validation of the submission.
class_docstr_tok: ["Class","which","performs","validation","of","the","submission","."]
docstr: Loads and verifies metadata.
  
  Returns:
    dictionaty with metadata or None if metadata not found or invalid
docstr_tok: ["Loads","and","verifies","metadata",".","Returns",":","dictionaty","with","metadata","or","None","if","metadata","not","found","or","invalid"]
code: def _load_and_verify_metadata(self):
      """Loads and verifies metadata.
  
      Returns:
        dictionaty with metadata or None if metadata not found or invalid
      """
      metadata_filename = os.path.join(
          self._extracted_submission_dir, "metadata.json"
      )
      if not os.path.isfile(metadata_filename):
          logging.error("metadata.json not found")
          return None
      try:
          with open(metadata_filename, "r") as f:
              metadata = json.load(f)
      except IOError as e:
          logging.error("Failed to load metadata: %s", e)
          return None
      for field_name in REQUIRED_METADATA_JSON_FIELDS:
          if field_name not in metadata:
              logging.error(
                  "Field %s not found in metadata", field_name
              )
              return None
      # Verify submission type
      if metadata["type"] not in ALLOWED_SUBMISSION_TYPES:
          logging.error(
              "Invalid submission type in metadata: %s",
              metadata["type"],
          )
          return None
      # Check submission entry point
      entry_point = metadata["entry_point"]
      if not os.path.isfile(
          os.path.join(self._extracted_submission_dir, entry_point)
      ):
          logging.error("Entry point not found: %s", entry_point)
          return None
      if not entry_point.endswith(".sh"):
          logging.warning(
              "Entry point is not an .sh script. "
              "This is not necessarily a problem, but if submission "
              "won"
              "t run double check entry point first: %s",
              entry_point,
          )
      # Metadata verified
      return metadata
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from builtins import int
  import csv
  import json
  import logging
  import os
  import re
  import subprocess
  import sys
  import numpy
  from PIL import Image
  from six import iteritems
label_desc: Use image node_id 5 for calling the SubmissionValidator obj's underlying member method code with example usage: obj._load_and_verify_metadata() and returns: metadata, None, None, None, None, None