def convert_from_timedelta(timedelta_val):
    """
    given a *timedelta_val* (datetime.timedelta), return a string representing the
    inverse of convert_to_timedelta, eg. "5m".
    """
    if timedelta_val.days:
        return "{days}d".format(days=timedelta_val.days)
    if timedelta_val.seconds:
        return "{seconds}s".format(seconds=timedelta_val.seconds)