Validates submission.

    Args:
      filename: submission filename

    Returns:
      submission metadata or None if submission is invalid

def validate_submission(self, filename):
    """Validates submission.

    Args:
      filename: submission filename

    Returns:
      submission metadata or None if submission is invalid
    """
    self._prepare_temp_dir()
    # Convert filename to be absolute path, relative path might cause problems
    # with mounting directory in Docker
    filename = os.path.abspath(filename)
    # extract submission
    if not self._extract_submission(filename):
      return None
    # verify submission size
    if not self._verify_submission_size():
      return None
    # Load metadata
    metadata = self._load_and_verify_metadata()
    if not metadata:
      return None
    submission_type = metadata['type']
    # verify docker container size
    if not self._verify_docker_image_size(metadata['container_gpu']):
      return None
    # Try to run submission on sample data
    self._prepare_sample_data(submission_type)
    if not self._run_submission(metadata):
      logging.error('Failure while running submission')
      return None
    if not self._verify_output(submission_type):
      logging.warning('Some of the outputs of your submission are invalid or '
                      'missing. You submission still will be evaluation '
                      'but you might get lower score.')
    return metadata