import itertools


def fock_bin(n, k):
    """
    Return all the possible :math:`n`-length binary where :math:`k` of :math:`n` digitals are set to 1.  

    Parameters
    ----------
    n : int
        Binary length :math:`n`.
 
    k : int
        How many digitals are set to be 1.

    Returns
    -------
    res : list of int-lists
        A list of list containing the binary digitals.

    Examples
    --------
    >>> fock_bin(4, 2)
    [[1, 1, 0, 0],
     [1, 0, 1, 0],
     [1, 0, 0, 1],
     [0, 1, 1, 0],
     [0, 1, 0, 1],
     [0, 0, 1, 1]] 

    """

    if n==0:
        return [[0]]

    res = []
    for bits in itertools.combinations(list(range(n)), k):
        s = [0] * n
        for bit in bits:
            s[bit] = 1
        res.append(s)
    return res