# There is place for date time utils functions def parse_time(value: str) -> int: """Converts time interval in text form into time interval as number of seconds. Args: value: time interval as text. Returns: Number of seconds in the parsed time interval. """ if value is None: return 0 value = value.lower() for suffix in ["s", "sec"]: if value.endswith(suffix): return int(value[: -len(suffix)]) for suffix in ["m", "min"]: if value.endswith(suffix): return int(value[: -len(suffix)]) * 60 for suffix in ["h", "hr", "hour"]: if value.endswith(suffix): return int(value[: -len(suffix)]) * 60 * 60 raise ValueError(f"Unknown units in time value '{value}'")