def format_one_query(q, read_seq, read_coords, barcode_dict=None):
    """Formats output.

    Parameters
    ----------
    q : dict
        A dictionary of fuzzy searching result. Key is levenshtein distance.
        Value is list of matched barcodes.
    read_seq : str
        A DNA string (full length read).
    read_coords : tuple or list
        The positions of read used for comparison.
    barcode_dict : dict, optional
        Names for the matched barcodes. Keys are barcode sequences. Values are
        alternative names.

    Returns
    -------
    str
        Sequencing read (full length).
    str
        Matched barcode or barcode name.
    str
        Levenshtein distance.
    """

    x, y = read_coords
    read_seq = (read_seq[:x].lower()
                + read_seq[x:y]
                + read_seq[y:].lower())

    if barcode_dict:
        barcode = barcode_dict[q[0]]
    else:
        barcode = q[0]

    return read_seq, barcode, str(q[1])