def get_middle_opt(string: str) -> str:
    """Get middle value of a string (efficient).

    Examples:
        >>> assert get_middle_opt('middle') == 'dd'
    """
    return (
        string[int(len(string) // 2) - 1 : int(len(string) // 2) + 1]
        if not len(string) % 2
        else string[int(len(string) // 2)]
    )