code: def __init__(self, project, socket_path=None, debug=False):
      self.project = project
  
      if socket_path is None:
          # create a new temporary file just to get a free name.
          # the Go GRPC server will create the file.
          f = tempfile.NamedTemporaryFile(
              prefix="keepsake-daemon-", suffix=".sock", delete=False
          )
          self.socket_path = f.name
          f.close()
      else:
          self.socket_path = socket_path
  
      # the Go GRPC server will fail to start if the socket file
      # already exists.
      os.unlink(self.socket_path)
  
      cmd = [DAEMON_BINARY]
      if self.project.repository:
          cmd += ["-R", self.project.repository]
      if self.project.directory:
          cmd += ["-D", self.project.directory]
      if debug:
          cmd += ["-v"]
      cmd.append(self.socket_path)
      self.process = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
      )
  
      # need to wrap stdout and stderr for this to work in jupyter
      # notebooks. jupyter redefines sys.std{out,err} as custom
      # writers that eventually write the output to the notebook.
      self.stdout_thread = start_wrapped_pipe(
          self.process.stdout, sys.stdout
      )
      self.stderr_thread = start_wrapped_pipe(
          self.process.stderr, sys.stderr
      )
  
      atexit.register(self.cleanup)
      self.channel = grpc.insecure_channel("unix://" + self.socket_path)
      self.stub = DaemonStub(self.channel)
  
      TIMEOUT_SEC = 15
      grpc.channel_ready_future(self.channel).result(
          timeout=TIMEOUT_SEC
      )
  
imports: import functools
  import tempfile
  import os
  from typing import Optional, Dict, Any, List
  import subprocess
  import atexit
  import sys
  import threading
  import grpc
  from google.rpc import status_pb2, error_details_pb2
  from .servicepb.keepsake_pb2_grpc import DaemonStub
  from .servicepb import keepsake_pb2
  from .None import pb_convert
  from .experiment import Experiment
  from .checkpoint import Checkpoint, PrimaryMetric
  from .None import exceptions
  from .None import console
label_desc: Use image node_id 1 to create a new Daemon object  with example: obj = Daemon(project, socket_path, debug)