from typing import Tuple
from typing import List


def extract_encoded_headers(payload: bytes) -> Tuple[str, bytes]:
    """This function's purpose is to extract lines that can be decoded using the UTF-8 decoder.
    >>> extract_encoded_headers("Host: developer.mozilla.org\\r\\nX-Hello-World: 死の漢字\\r\\n\\r\\n".encode("utf-8"))
    ('Host: developer.mozilla.org\\r\\nX-Hello-World: 死の漢字\\r\\n', b'')
    >>> extract_encoded_headers("Host: developer.mozilla.org\\r\\nX-Hello-World: 死の漢字\\r\\n\\r\\nThat IS totally random.".encode("utf-8"))
    ('Host: developer.mozilla.org\\r\\nX-Hello-World: 死の漢字\\r\\n', b'That IS totally random.')
    """
    result: str = ""
    lines: List[bytes] = payload.splitlines()
    index: int = 0

    for line, index in zip(lines, range(0, len(lines))):
        if line == b"":
            return result, b"\r\n".join(lines[index + 1 :])

        try:
            result += line.decode("utf-8") + "\r\n"
        except UnicodeDecodeError:
            break

    return result, b"\r\n".join(lines[index + 1 :])