def as_mask(n, coding='big'):
    """
    Returns `n` as a bit mask, namely an iterable of bits, according to `coding` scheme.

    Keyword argument `coding` represent the coding scheme used to build the mask, it 
    resembles keyword `byteorder` in function `int.to_bytes`. If it is 'big', then
    a `big endian` scheme is applied, namely most significant bits of `n` are at 
    the *beginning* of the returned mask; otherwise a `little endian` scheme applies, 
    namely most significant bits of `n` are at the *end* of the returned mask.

    Examples
    ========

    >>> as_mask(12, coding='big')
    (1, 1, 0, 0)

    >>> as_mask(12, coding='little')
    (0, 0, 1, 1)

    """
    m = map(int, bin(n)[2:])
    return tuple(m if coding == 'big' else reversed(list(m)))