def score_text(text: str, frequency: str = "etaoinsrhldcumfpgwybvkxjqz ETAOINSRHLDCUMFPGWYBVKXJQZ.?!1234567890") -> int:
    """Scores a string on its resemblance to english text by using letter frequency.
    The lower the returned integer, the better the score.
    :param text The ascii string to score
    :param frequency A "letter frequency string" to use as a scoring metric. Defaults to etoin shrdlu based string.
    :returns an integer score on the resemblance of the string to English text, where a low score is preferred."""
    score: int = 0
    # actual scoring algorithm
    for c in text:
        index = frequency.find(c)
        score += index if index >= 0 else 255  # punish characters not found in the high frequency string.
    return score