class_docstr: Tests for BigQuery adapter.
class_docstr_tok: ["Tests","for","BigQuery","adapter","."]
docstr: Normalizes dictionary.
docstr_tok: ["Normalizes","dictionary","."]
code: def _normalize_dictionary(dictionary):
      """Normalizes dictionary."""
      for key, value in dictionary.items():
          if isinstance(value, ops.Tensor):
              # for compartibility with Python 2
              dictionary[key] = value.numpy()
          value = dictionary[key]
          if isinstance(value, np.ndarray):
              lst = value.tolist()
              dictionary[key] = [
                  x.decode() if isinstance(x, bytes) else x for x in lst
              ]
          if isinstance(value, bytes):
              # because FakeBigQueryServer.serialize_to_avro serializes strings as byte arrays
              dictionary[key] = value.decode()
      return dict(dictionary)
  
imports: import concurrent.futures
  from io import BytesIO
  import json
  import fastavro
  import pytest
  import sys
  import numpy
  import grpc
  import tensorflow
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow import test
  from tensorflow_io.bigquery import BigQueryTestClient, BigQueryClient
  import google.cloud.bigquery_storage_v1beta1.proto.storage_pb2_grpc
  import google.cloud.bigquery_storage_v1beta1.proto.storage_pb2
label_desc: Use image node_id 1 for calling the BigqueryOpsTest obj's underlying member method code with example usage: obj._normalize_dictionary(dictionary) and returns: dict