def extract_barcode(record, embedded_barcode):
    """extracts barcodes from a fastq record according to an EmbeddedBarcode object.

    :param FastqRecord record: record to extract from
    :param EmbeddedBarcode embedded_barcode: defines the barcode start and end and the names of the quality
      and sequence tags
    :return tuple: (sequence tag name, tag content (nucleotides), tag type (Z))
    :return tuple: (quality tag name, tag content (qualities), tag type (Z))
    """
    seq = record.sequence[embedded_barcode.start:embedded_barcode.end]
    qual = record.quality[embedded_barcode.start:embedded_barcode.end]
    return (embedded_barcode.sequence_tag, seq, 'Z'), (embedded_barcode.
        quality_tag, qual, 'Z')
