code: def vectorize(
      hash_function: Callable[[Any, int], int],
      feature_dict: Optional[Dict[int, str]] = None,
      size: int = 1024,
      feature_list: Optional[List] = None,
  ) -> np.ndarray:
      """Helper function to vectorize a spatial description from a hash.
  
      Hash functions are used to perform spatial featurizations in
      DeepChem. However, it's necessary to convert backwards from
      the hash function to feature vectors. This function aids in
      this conversion procedure. It creates a vector of zeros of length
      `size`. It then loops through `feature_dict`, uses `hash_function`
      to hash the stored value to an integer in range [0, size) and bumps
      that index.
  
      Parameters
      ----------
      hash_function: Function, Callable[[str, int], int]
          Should accept two arguments, `feature`, and `size` and
          return a hashed integer. Here `feature` is the item to
          hash, and `size` is an int. For example, if `size=1024`,
          then hashed values must fall in range `[0, 1024)`.
      feature_dict: Dict, optional (default None)
          Maps unique keys to features computed.
      size: int (default 1024)
          Length of generated bit vector
      feature_list: List, optional (default None)
          List of features.
  
      Returns
      -------
      feature_vector: np.ndarray
          A numpy array of shape `(size,)`
      """
      feature_vector = np.zeros(size)
      if feature_dict is not None:
          on_channels = [
              hash_function(feature, size)
              for key, feature in feature_dict.items()
          ]
          feature_vector[on_channels] += 1
      elif feature_list is not None:
          feature_vector[0] += len(feature_list)
  
      return feature_vector
  
imports: from typing import Callable, Dict, Optional, Tuple, Any, List
  import numpy
  import hashlib
label_desc: Use image node_id 4 for calling a global function with example usage: vectorize(hash_function, feature_dict, size, feature_list) and returns: feature_vector