Checks that a number that represents a date as milliseconds is correct.

def is_valid_timestamp(date, unit='millis'):
    """
    Checks that a number that represents a date as milliseconds is correct.
    """
    assert isinstance(date, int), "Input is not instance of int"

    if unit is 'millis':
        return is_positive(date) and len(str(date)) == 13
    elif unit is 'seconds':
        return is_positive(date) and len(str(date)) == 10
    else:
        raise ValueError('Unknown unit "%s"' % unit)