def sec2unit(value, force=None):
    """Convert a value in seconds in the most appropriate unit
        or in the required unit
        force:   unit required"""
    unit = 'sec'
    if value is None:
        return value, ''
    if force == unit:
        return value, unit
    if value >= 60 and value % 60.0 == 0:
        value /= 60
        unit = 'min'
        if force == unit:
            return value, unit
    if value >= 60 and value % 60.0 == 0:
        value /= 60
        unit = 'hour'
        if force == unit:
            return value, unit
    if value >= 24 and value % 24.0 == 0:
        value /= 24
        unit = 'day'
    return value, unit
