code: def create_pid_file(process_name):
      
      pid_filename = get_pid_filename(process_name)
      try:
          with open(pid_filename, mode='w') as pid_file:
              pid_file.write(str(os.getpid()))
      except Exception as e:
          print('Unable to create pid file at: {0}, because of: {1}'.format(pid_filename, e),
                file=sys.stderr)
docs: creates pid file and writes os.pid() in there