code: def replace_inf_values(
      feature_matrix, replacement_value=np.nan, columns=None
  ):
      """Replace all ``np.inf`` values in a feature matrix with the specified replacement value.
  
      Args:
          feature_matrix (DataFrame): DataFrame whose columns are feature names and rows are instances
          replacement_value (int, float, str, optional): Value with which ``np.inf`` values will be replaced
          columns (list[str], optional): A list specifying which columns should have values replaced. If None,
              values will be replaced for all columns.
  
      Returns:
          feature_matrix
  
      """
      if columns is None:
          feature_matrix = feature_matrix.replace(
              [np.inf, -np.inf], replacement_value
          )
      else:
          feature_matrix[columns] = feature_matrix[columns].replace(
              [np.inf, -np.inf],
              replacement_value,
          )
      return feature_matrix
  
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 11 for calling a global function with example usage: replace_inf_values(feature_matrix, replacement_value, columns) and returns: feature_matrix