code: def import_(path):
      # Load the checkpoint metadata first.
      path = os.path.expanduser(path)
      try:
          with tarfile.open(path) as f:
              # This way of loading the JSON works in all supported versions of
              # Python 2 and 3.
              # See: https://github.com/tryolabs/luminoth/issues/222
              metadata = json.loads(
                  f.extractfile("metadata.json").read().decode("utf-8")
              )
      except tarfile.ReadError:
          click.echo("Invalid file. Is it an exported checkpoint?")
          return
      except KeyError:
          click.echo(
              "Tar file doesn't contain `metadata.json`. "
              "Is it an exported checkpoint?"
          )
          return
  
      # Check if checkpoint isn't present already.
      db = read_checkpoint_db()
      checkpoint = get_checkpoint(db, metadata["id"])
      if checkpoint:
          click.echo(
              "Checkpoint '{}' already found in index.".format(
                  metadata["id"]
              )
          )
          return
  
      # Check if the output directory doesn't exist already.
      output_path = get_checkpoint_path(metadata["id"])
      if os.path.exists(output_path):
          click.echo(
              "Checkpoint directory '{}' for checkpoint_id '{}' already exists. "
              "Try issuing a `lumi checkpoint delete` or delete the directory "
              "manually.".format(output_path, metadata["id"])
          )
          return
  
      # Extract all the files except `metadata.json` into the checkpoint
      # directory.
      with tarfile.open(path) as f:
          members = [
              m for m in f.getmembers() if m.name != "metadata.json"
          ]
          f.extractall(output_path, members)
  
      # Store metadata into the checkpoint index.
      db["checkpoints"].append(metadata)
      save_checkpoint_db(db)
  
      click.echo(
          "Checkpoint {} imported successfully.".format(metadata["id"])
      )
  
imports: import click
  import json
  import os
  import shutil
  import six
  import requests
  import tarfile
  import tempfile
  import tensorflow
  import uuid
  from datetime import datetime
  from luminoth import __version__
  from luminoth.utils.config import get_config
  from luminoth.utils.homedir import get_luminoth_home
label_desc: Use image node_id 21 for calling a global function with example usage: import_(path) without return types