def duration_to_timedelta(obj):
    """Converts duration to timedelta

    >>> duration_to_timedelta("10m")
    >>> datetime.timedelta(0, 600)
    """
    matches = DURATION_PATTERN.search(obj)
    matches = matches.groupdict(default="0")
    matches = {k: int(v) for k, v in matches.items()}
    return timedelta(**matches)