def get_tag_bytestring(alignment: bytes, len_read_name: int,
    number_cigar_operations: int, len_sequence: int) ->bytes:
    """Extract the raw tags from a BAM alignment bytestring

    Parameters
    ----------
    alignment : bytes
        A byte string of a bam alignment entry in raw binary format

    len_read_name : int
        The length of the readname string
        eg from pylazybam.bam.get_len_read_name()

    number_cigar_operations : int
        The number of cigar operations
        eg from pylazybam.bam.get_number_cigar_operations()

    len_sequence : int
        The length of the sequence and quality score strings
        eg from pylazybam.bam.get_len_sequence

    Returns
    -------
    bytes
        The raw tags in BAM format as a binary bytestring

    """
    start = 36 + len_read_name + 4 * number_cigar_operations + (len_sequence +
        1) // 2 + len_sequence
    return alignment[start:]
