def defined_characters(version=None, scr=None):
    """Returns the set of all defined characters in the Unicode Standard."""
    load_data()
    # handle common error where version is passed as string, the age test
    # will always pass
    if version is not None:
        version = float(version)
    try:
        return _DEFINED_CHARACTERS_CACHE[(version, scr)]
    except KeyError:
        pass
    characters = _defined_characters
    if version is not None:
        characters = {
            char
            for char in characters
            if age(char) is not None and float(age(char)) <= version
        }
    if scr is not None:
        characters = {
            char
            for char in characters
            if script(char) == scr or scr in script_extensions(char)
        }
    characters = frozenset(characters)
    _DEFINED_CHARACTERS_CACHE[(version, scr)] = characters
    return characters