code: def extract_imports(source):
      """(Taken from `hyperas.utils`). Construct a string containing all imports from `source`
  
      Parameters
      ----------
      source: String
          A stringified fragment of source code
  
      Returns
      -------
      imports_str: String
          The stringified imports from `source`"""
      tree = parse(source)
      import_parser = ImportParser()
      import_parser.visit(tree)
      import_lines = ["#coding=utf-8\n"]
  
      for line in import_parser.lines:
          if "print_function" in line:
              import_lines.append(line + "\n")
          elif ("_pydev_" in line) or ("java.lang" in line):
              continue  # Skip imports for PyCharm, and Eclipse
          else:
              import_lines.append(
                  "try:\n    {}\nexcept:\n    pass\n".format(line)
              )
  
      imports_str = "\n".join(import_lines)
      return imports_str
  
imports: from hyperparameter_hunter.utils.file_utils import RetryMakeDirs
  from ast import NodeVisitor, parse
  from inspect import getsource
  from operator import attrgetter
  import os
  import re
label_desc: Use image node_id 5 for calling a global function with example usage: extract_imports(source) and returns: imports_str