docs: def replaceVariables(path, datetime=None, pathvars=None):
      """Return absolute path with path variables replaced as applicable"""
  
      if datetime is None:
          datetime = time.gmtime()
  
      # if path variables are not given, set as empty list
      if pathvars is None:
          pathvars = [ ]
  
      # create an init path list to loop through
      if isinstance(path, list):
          path_list = path
      else:
          path_list = [ path ]
  
      # Set up the regex to search for variables
      regex = re.compile('\$\{(.*?)\}')
  
      # create a newpath list that will hold the 'cleaned' paths
      # with variables and strftime format directives replaced
      newpath_list = [ ]
  
      for p in path_list:
          # create temppath_list to be used a we work through the
          newpath_list.append(p)
  
          # Variable replacement
          # Find all the variables in path using the regex
          for k in regex.findall(p):
              # Check if the key is in path variables map
              if k in pathvars:
                  # get the str or list of values
                  v = pathvars[k]
  
                  # Check value of variable must be in (string, integer, list)
                  if type(v) is dict:
                      msg = "Path variable must refer to string, integer, or list"
                      raise TypeError(msg)
  
                  # get the list of possible variable values
                  value_list = v if type(v) is list else [ v ]
  
  
                  # create temp_list for now
                  temp_list = []
  
                  # loop through the most recent newpath list
                  # need to do this every time in order to account for all possible
                  # combinations
                  # replace the variables
                  # loop through the list of values and replace the variables
                  for v in value_list:
                      for newpath in newpath_list:
                          # remove the path from newpath_list
                          temp_list.append(newpath.replace('${%s}' % k, str(v)))
  
                  # replace newpath_list
                  newpath_list = temp_list
  
          # strftime translation
          # Loop through newpath_list to do strftime translation
          for index, newpath in enumerate(newpath_list):
              # Apply strftime translation
              newpath_list[index] = time.strftime(newpath, datetime)
  
      return newpath_list