def timedelta_to_string(timedelta):
    """
    Utility that converts a pandas.Timedelta to a string representation
    compatible with pandas.Timedelta constructor format

    Parameters
    ----------
    timedelta: pd.Timedelta

    Returns
    -------
    string
        string representation of 'timedelta'
    """
    c = timedelta.components
    timedelta_format = ''
    if c.days != 0:
        timedelta_format += '%dD' % c.days
    if c.hours > 0:
        timedelta_format += '%dh' % c.hours
    if c.minutes > 0:
        timedelta_format += '%dm' % c.minutes
    if c.seconds > 0:
        timedelta_format += '%ds' % c.seconds
    if c.milliseconds > 0:
        timedelta_format += '%dms' % c.milliseconds
    if c.microseconds > 0:
        timedelta_format += '%dus' % c.microseconds
    if c.nanoseconds > 0:
        timedelta_format += '%dns' % c.nanoseconds
    return timedelta_format
