code: def get_forward_returns_columns(
      columns, require_exact_day_multiple=False
  ):
      """
      Utility that detects and returns the columns that are forward returns
      """
  
      # If exact day multiples are required in the forward return periods,
      # drop all other columns (e.g. drop 3D12h).
      if require_exact_day_multiple:
          pattern = re.compile(r"^(\d+([D]))+$", re.IGNORECASE)
          valid_columns = [
              (pattern.match(col) is not None) for col in columns
          ]
  
          if sum(valid_columns) < len(valid_columns):
              warnings.warn(
                  "Skipping return periods that aren't exact multiples"
                  + " of days."
              )
      else:
          pattern = re.compile(
              r"^(\d+([Dhms]|ms|us|ns]))+$", re.IGNORECASE
          )
          valid_columns = [
              (pattern.match(col) is not None) for col in columns
          ]
  
      return columns[valid_columns]
  
imports: import pandas
  import numpy
  import re
  import warnings
  from IPython.display import display
  from pandas.tseries.offsets import CustomBusinessDay, Day, BusinessDay
  from scipy.stats import mode
label_desc: Use image node_id 13 for calling a global function with example usage: get_forward_returns_columns(columns, require_exact_day_multiple) and returns: columns