def create_last_n_1_bits_mask(n):
    """ Return a binary mask of last n bits of 1 """
    if n < 0:
        raise ValueError("n and k cannot be negative number")

    if n == 0:
        return 0

    return (2 << n) - 1