code: def ClosedNamedTempFile(contents):
      try:
          with tempfile.NamedTemporaryFile(delete=False) as f:
              file_name = f.name
              f.write(contents)
          yield file_name
      finally:
          os.unlink(file_name)
  
imports: from hyperopt import hp
  from contextlib import contextmanager
  import re
  import functools
  import random
  import numpy
  import numpy.random
  import pkg_resources
  import tempfile
  import scipy.stats
  import os
  import math
  import hyperopt
  import datetime
  import json
  import copy
label_desc: Use image node_id 1 for calling a global function with example usage: ClosedNamedTempFile(contents) without return types