def check_bucket_valid(bucket):
    """
    Check bucket name whether is legal.

    :type bucket: string
    :param bucket: None
    =======================
    :return:
        **Boolean**
    """
    alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789-'
    if len(bucket) < 3 or len(bucket) > 63:
        return False
    if bucket[-1] == '-' or bucket[-1] == '_':
        return False
    if not ('a' <= bucket[0] <= 'z' or '0' <= bucket[0] <= '9'):
        return False
    for i in bucket:
        if not i in alphabet:
            return False
    return True
