from typing import List
from typing import Tuple


def _calculate_gamma_and_epsilon(zero_counts: List[int], one_counts: List[int]) -> Tuple[int, int]:
    """Calculates the gamma and epsilon rate based on the one and zero counts the returns them.

    Args:
        zero_counts (List[int]): the number of 0 digits across all diagnostic data for
        each digit position
        one_counts (List[int]): the number of 1 digits across all diagnostic data for
        each digit position

    Returns Tuple[int,int]:  (gamma, epsilon)
    """
    binary_number = ''
    binary_number_complement = ''

    for one_count, zero_count in zip(one_counts, zero_counts):
        binary_number += (str(int(one_count > zero_count)))
        binary_number_complement += (str(int(one_count < zero_count)))

    gamma = int(binary_number, base=2)
    epsilon = int(binary_number_complement, base=2)
    return gamma, epsilon