def state_to_str(state, n_qubits=4, ket=True):
    """ takes a state as a number, and returns the string
        specifying ket=True draws angle brackts around the string """
    # "state" is not the right term here ...
    binary_str = bin(state)[2:].zfill(n_qubits)

    if ket:
        binary_str = '|'+binary_str+'>'

    return binary_str