'Validate a time value.
Args:
value: Value to validate.
key: Name of the field being validated.
Raises:
ValidationError: if value is not a time value with the expected format.'

def Validate(self, value, key):

    if (not isinstance(value, basestring)):
        raise ValidationError(("Value    '%s'    for    %s    is    not    a    string    (%s)" % (value, key, TimeValue._EXPECTED_SYNTAX)))
    if (not value):
        raise ValidationError(('Value    for    %s    is    empty    (%s)' % (key, TimeValue._EXPECTED_SYNTAX)))
    if (value[(-1)] not in 'smhd'):
        raise ValidationError(("Value    '%s'    for    %s    must    end    with    a    time    unit,    one    of    s    (seconds),    m    (minutes),    h    (hours),    or    d    (days)" % (value, key)))
    try:
        t = float(value[:(-1)])
    except ValueError:
        raise ValidationError(("Value    '%s'    for    %s    is    not    a    valid    time    value    (%s)" % (value, key, TimeValue._EXPECTED_SYNTAX)))
    if (t < 0):
        raise ValidationError(("Value    '%s'    for    %s    is    negative    (%s)" % (value, key, TimeValue._EXPECTED_SYNTAX)))
    return value
