def pop_n(seq, n):
    """
    Pops first n elements from a mutable bytearray
    :param seq: Input bytearray
    :param n: The number of elements to pop
    :return: First n elements of the input bytearray
    """
    tmp = seq[:n]
    del seq[:n]
    return bytes(tmp)