import time


def fade_to_black(connection):

    """Transition from the current brightness to zero in a smooth fade"""

    command = "X03FE" # Lowers by 2 points

    # Loop until the number is 0
    i = 0
    while i < 128:
        connection.write(bytes(command, 'UTF-8'))
        i += 1
        time.sleep(0.03)

    return True