def parse_header(header):
    """
    Extract size= and barcode= fields from the FASTA/FASTQ header line

    >>> parse_header("name;size=12;barcode=ACG;")
    ('name', 12, 'ACG')
    >>> parse_header("another name;size=200;foo=bar;")
    ('another name', 200, None)
    """
    fields = header.split(';')
    query_name = fields[0]
    size = barcode = None
    for field in fields[1:]:
        if field == '':
            continue
        if '=' in field:
            key, value = field.split('=', maxsplit=1)
            if key == 'size':
                size = int(value)
            elif key == 'barcode':
                barcode = value
    return query_name, size, barcode