def get_time_delta(time_string: str) -> timedelta:
rel_time: Pattern = re.compile(<EOL>pattern=r"<STR_LIT>",<EOL>flags=re.IGNORECASE,<EOL>)<EOL>parts: Optional[Match[AnyStr]] = rel_time.match(string=time_string)<EOL>if not parts:<EOL><INDENT>raise Exception(f"<STR_LIT>")<EOL><DEDENT>parts: Dict[str, str] = parts.groupdict()<EOL>time_params = {}<EOL>if all(value == None for value in parts.values()):<EOL><INDENT>raise Exception(f"<STR_LIT>")<EOL><DEDENT>for time_unit, magnitude in parts.items():<EOL><INDENT>if magnitude:<EOL><INDENT>time_params[time_unit]: int = int(magnitude)<EOL><DEDENT><DEDENT>return timedelta(**time_params)<EOL>
Takes a time string (1 hours, 10 days, etc.) and returns
a python timedelta object

:param time_string: the time value to convert to a timedelta
:type time_string: str
:returns: datetime.timedelta for relative time
:type datetime.timedelta