def _gather_output(counts, lines, byte_count, chars, words, max_line_length):
    """Takes all available metrics and returns information filtered to reflect user
    options.

    :param counts: The actual measurments returned by _examine_fp(fp)
    :param lines: Whether to include line counts
    :param byte_count: Whether to include bytes count
    :param chars: Whether to include chars count
    :param words: Whether to include word count
    :param max_line_lenth: Whether to include max_line_length

    :type max_line_lenth: boolean
    :type words: boolean
    :type chars: boolean
    :type byte_count: boolean
    :type lines: boolean
    :type counts: tuple
    """
    current_lines = counts[0]
    current_words = counts[1]
    current_bytes = counts[2]
    current_chars = counts[3]
    current_max_line_length = counts[4]
    current_name = counts[5]
    if not any((lines, byte_count, chars, words, max_line_length)):
        return current_lines, current_words, current_bytes, current_name
    else:
        ret = current_name,
        if max_line_length:
            ret = (current_max_line_length,) + ret
        if byte_count:
            ret = (current_bytes,) + ret
        if chars:
            ret = (current_chars,) + ret
        if words:
            ret = (current_words,) + ret
        if lines:
            ret = (current_lines,) + ret
        return ret
