def get_formatted(self, key):
        """Return formatted value for context[key].

        If context[key] is a type string, will just format and return the
        string.
        If context[key] is a special literal type, like a py string or sic
        string, will run the formatting implemented by the custom tag
        representer.
        If context[key] is not a string, specifically an iterable type like a
        dict, list, tuple, set, it will use get_formatted_iterable under the
        covers to loop through and handle the entire structure contained in
        context[key].

        Returns a string interpolated from the context dictionary.

        If context[key]='Piping {key1} the {key2} wild'
        And context={'key1': 'down', 'key2': 'valleys', 'key3': 'value3'}

        Then this will return string: "Piping down the valleys wild"

        Args:
            key: dictionary key to retrieve.

        Returns:
            Formatted string.

        Raises:
            KeyNotInContextError: context[key] value contains {somekey} where
                                  somekey does not exist in context dictionary.

        """
        val = self[key]

        if isinstance(val, str):
            try:
                return self.get_processed_string(val)
            except KeyNotInContextError as err:
                # Wrapping the KeyError into a less cryptic error for end-user
                # friendliness
                raise KeyNotInContextError(
                    f'Unable to format \'{val}\' at context[\'{key}\'], '
                    f'because {err}'
                ) from err
        elif isinstance(val, SpecialTagDirective):
            return val.get_value(self)
        else:
            # any sort of complex type will work with get_formatted_iterable.
            return self.get_formatted_iterable(val)
Return formatted value for context[key].

        If context[key] is a type string, will just format and return the
        string.
        If context[key] is a special literal type, like a py string or sic
        string, will run the formatting implemented by the custom tag
        representer.
        If context[key] is not a string, specifically an iterable type like a
        dict, list, tuple, set, it will use get_formatted_iterable under the
        covers to loop through and handle the entire structure contained in
        context[key].

        Returns a string interpolated from the context dictionary.

        If context[key]='Piping {key1} the {key2} wild'
        And context={'key1': 'down', 'key2': 'valleys', 'key3': 'value3'}

        Then this will return string: "Piping down the valleys wild"

        Args:
            key: dictionary key to retrieve.

        Returns:
            Formatted string.

        Raises:
            KeyNotInContextError: context[key] value contains {somekey} where
                                  somekey does not exist in context dictionary.