docs: def _get_metadata(job_id):
      """Return any metadata for the given job_id from the metadata table."""
      # Avoid SQLAlchemy "Unicode type received non-unicode bind param value"
      # warnings.
      job_id = unicode(job_id)
  
      results = ENGINE.execute(
          METADATA_TABLE.select().where(
              METADATA_TABLE.c.job_id == job_id)).fetchall()
      metadata = {}
      for row in results:
          value = row['value']
          if row['type'] == 'json':
              value = json.loads(value)
          metadata[row['key']] = value
      return metadata