class_docstr: Contains methods to parse the input offset to different formats.
  
  Args:
      now (datetime):
          The point of time that the parser should calculate offset against.
class_docstr_tok: ["Contains","methods","to","parse","the","input","offset","to","different","formats",".","Args",":","now","(","datetime",")",":","The","point","of","time","that","the","parser","should","calculate","offset","against","."]
docstr: Parse the offset to time delta.
  
  Args:
      offset (Optional[str]): Offset that is used for target date calcluation.
  
  Raises:
      ValueError: If an offset is provided in a unrecognizable format.
      ValueError: If an invalid offset unit is provided.
  
  Returns:
      reletivedelta: Time delta representation of the time offset.
docstr_tok: ["Parse","the","offset","to","time","delta",".","Args",":","offset","(","Optional","[","str","]",")",":","Offset","that","is","used","for","target","date","calcluation",".","Raises",":","ValueError",":","If","an","offset","is","provided","in","a","unrecognizable","format",".","ValueError",":","If","an","invalid","offset","unit","is","provided",".","Returns",":","reletivedelta",":","Time","delta","representation","of","the","time","offset","."]
code: def parse_offset_to_timedelta(offset: Optional[str]) -> relativedelta:
      """Parse the offset to time delta.
  
      Args:
          offset (Optional[str]): Offset that is used for target date calcluation.
  
      Raises:
          ValueError: If an offset is provided in a unrecognizable format.
          ValueError: If an invalid offset unit is provided.
  
      Returns:
          reletivedelta: Time delta representation of the time offset.
      """
      if offset is None:
          return None
  
      unit_match = re.fullmatch(UNIT_RE, offset)
  
      if not unit_match:
          raise ValueError(
              f"[{offset}] is not in a valid offset format. "
              "Please pass a valid offset e.g '1 day'."
          )
  
      multiple, unit = unit_match.groups()
  
      if unit not in VALID_UNITS:
          raise ValueError(
              f"[{unit}] is not a valid offset unit. Supported units: {VALID_UNITS}"
          )
  
      shift_args = {f"{unit}s": -int(multiple)}
  
      return relativedelta(**shift_args)
  
file_path: sagemaker-python-sdk/src/sagemaker/feature_store/feature_processor/_input_offset_parser.py
imports: from __future__ import absolute_import
  import re
  from typing import Optional, Tuple, Union
  from datetime import datetime, timezone
  from dateutil.relativedelta import relativedelta
  from sagemaker.feature_store.feature_processor._constants import EXECUTION_TIME_PIPELINE_PARAMETER_FORMAT
label_desc: Use image node_id 5 for calling the InputOffsetParser obj's underlying member method code with example usage: obj.parse_offset_to_timedelta(offset) and returns: relativedelta, None