message: Import portpicker inside create_local_cluster function. Right now portpicker is
  imported at the top of the file and error is saved. Then, the error is printed
  inside create_local_cluster function. This creates extra references to upstream stack frames preventing them from getting garbage collected.
  Fixes
diff: @@ -37,14 +37,6 @@ from absl.testing import parameterized
  import numpy as np
  import six
  -_portpicker_import_error = None
  -try:
  - import portpicker # pylint: disable=g-import-not-at-top
  -except ImportError as _error:
  - _portpicker_import_error = _error
  - portpicker = None
  -
  -# pylint: disable=g-import-not-at-top
  from google.protobuf import descriptor_pool
  from google.protobuf import text_format
  @@ -3093,8 +3085,7 @@ def create_local_cluster(num_workers,
  Raises:
  ImportError: if portpicker module was not found at load time
  """
  - if _portpicker_import_error:
  - raise _portpicker_import_error # pylint: disable=raising-bad-type
  + import portpicker # pylint: disable=g-import-not-at-top
  worker_ports = [portpicker.pick_unused_port() for _ in range(num_workers)]
  ps_ports = [portpicker.pick_unused_port() for _ in range(num_ps)]
  cluster_dict = {
  