def binary_range(bits):
    """Return a list of all possible binary numbers in order with width=bits. 

    It would be nice to extend it to match the
    functionality of python's range() built-in function.

    """
    l = []
    v = ['0'] * bits
    toggle = [1] + [0] * bits
    while toggle[bits] != 1:
        v_copy = v[:]
        v_copy.reverse()
        l.append(''.join(v_copy))
        toggle = [1] + [0] * bits
        i = 0
        while i < bits and toggle[i] == 1:
            if toggle[i]:
                if v[i] == '0':
                    v[i] = '1'
                    toggle[i + 1] = 0
                else:
                    v[i] = '0'
                    toggle[i + 1] = 1
            i += 1
    return l
