def parse_duration(s: str) -> float: """Parse a duration string to seconds. Suffixes: ms (milliseconds), s (seconds), m (minutes). A bare number is treated as seconds. """ s = s.strip() if s.endswith("ms"): return float(s[:-2]) / 1000 if s.endswith("s"): return float(s[:-1]) if s.endswith("m"): return float(s[:-1]) * 60 return float(s)