from typing import Iterable
from typing import List
from typing import Tuple


def get_eigenvalues_with_degeneracies(evals: Iterable[float]) -> List[Tuple[float, int]]:
    """
    Given a set of sorted eigenvalues (possibly including degenerate eigenvalues), return a list of
    (eigenvalue, degeneracy) pairs, with eigenvalues represented as floats rounded to 3dp.
    """
    cur = None
    count = 0
    result = []

    for e in evals:
        e = round(e, 3)

        if e == cur:
            count += 1
        else:
            if cur is not None:
                result.append((cur, count))
            cur = e
            count = 1

    if count > 0:
        result.append((cur, count))

    return result