code: def n_jobs_to_workers(n_jobs):
      try:
          cpus = len(psutil.Process().cpu_affinity())
      except AttributeError:
          cpus = psutil.cpu_count()
  
      # Taken from sklearn parallel_backends code
      # https://github.com/scikit-learn/scikit-learn/blob/27bbdb570bac062c71b3bb21b0876fd78adc9f7e/sklearn/externals/joblib/_parallel_backends.py#L120
      if n_jobs < 0:
          workers = max(cpus + 1 + n_jobs, 1)
      else:
          workers = min(n_jobs, cpus)
  
      assert workers > 0, "Need at least one worker"
      return workers
  
imports: import logging
  import os
  import typing
  import warnings
  from datetime import datetime
  from functools import wraps
  import numpy
  import pandas
  import psutil
  from woodwork.logical_types import Datetime, Double
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.feature_base import AggregationFeature, DirectFeature
  from featuretools.utils import Trie
  from featuretools.utils.gen_utils import Library, import_or_none, is_instance
  from featuretools.utils.wrangle import _check_time_type, _check_timedelta
label_desc: Use image node_id 6 for calling a global function with example usage: n_jobs_to_workers(n_jobs) and returns: workers