from typing import Tuple


def count_gamma_and_epsilon_rate(bits_in_lines) -> Tuple:
    """
    Gamma rate is calculated from prevailing (digit (0 or 1) in each position
    Epsilon rate is opposite number (eg. '010' was made from gamma rate '101')

    Args:
        bits_in_lines (dict): nested dictionary, counted '0' and '1' for each
                              position in list of binary numbers

    Returns:
        Tuple: gamma and epsilon rate
    """
    gamma_rate = ""
    epsilon_rate = ""
    for value in bits_in_lines.values():
        gamma_rate += "0" if value["0"] > value["1"] else "1"

    for bit in gamma_rate:
        epsilon_rate += "0" if bit == "1" else "1"

    return gamma_rate, epsilon_rate