code: def _construct_auto_distance(features, column_types):
      
  
      ## Put input features into buckets based on type.
      numeric_ftrs = []
      string_ftrs = []
      dict_ftrs = []
  
      for ftr in features:
          try:
              ftr_type = column_types[ftr]
          except:
              raise ValueError("The specified feature does not exist in the " +
                               "input data.")
  
          if ftr_type == str:
              string_ftrs.append(ftr)
  
          elif ftr_type == dict:
              dict_ftrs.append(ftr)
  
          elif ftr_type in [int, float, _array.array]:
              numeric_ftrs.append(ftr)
  
          else:
              raise TypeError("Unable to automatically construct a distance " +
                              "function for feature '{}'. ".format(ftr) +
                              "For the nearest neighbor classifier, features " +
                              "must be of type integer, float, string, dictionary, " +
                              "or array.array.")
  
      ## Construct the distance function
      dist = []
  
      for ftr in string_ftrs:
          dist.append([[ftr], 'levenshtein', 1])
  
      if len(dict_ftrs) > 0:
          dist.append([dict_ftrs, 'weighted_jaccard', len(dict_ftrs)])
  
      if len(numeric_ftrs) > 0:
          dist.append([numeric_ftrs, 'euclidean', len(numeric_ftrs)])
  
      return dist
docs: Construct a composite distance function for a set of features, based on the
      types of those features.
  
      NOTE: This function is very similar to
      `:func:_nearest_neighbors.choose_auto_distance`. The function is separate
      because the auto-distance logic different than for each nearest
      neighbors-based toolkit.
  
      Parameters
      ----------
      features : list[str]
          Names of for which to construct a distance function.
  
      column_types : dict(string, type)
          Names and types of all columns.
  
      Returns
      -------
      dist : list[list]
          A composite distance function. Each element of the inner list has three
          elements: a list of feature names (strings), a distance function name
          (string), and a weight (float).