<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def block( self, before='', # type: typing.Text after='', # type: typing.Text delim=('{', '}'), # type: DelimTuple dent=None, # type: typing.Optional[int] allman=False # type: bool ):
 """ A context manager that emits configurable lines before and after an indented block of text. This is convenient for class and function definitions in some languages. Args: before (str):
 The string to be output in the first line which is not indented.. after (str):
 The string to be output in the last line which is not indented. delim (str, str):
 The first element is added immediately following `before` and a space. The second element is added prior to a space and then `after`. dent (int):
 The amount to indent the block. If none, the default indentation increment is used (four spaces or one tab). allman (bool):
 Indicates whether to use `Allman` style indentation, or the default `K&R` style. If there is no `before` string this is ignored. For more details about indent styles see http://en.wikipedia.org/wiki/Indent_style """

        assert len(delim) == 2, 'delim must be a tuple of length 2'
        assert (isinstance(delim[0], (six.text_type, type(None))) and
                isinstance(delim[1], (six.text_type, type(None)))), (
            'delim must be a tuple of two optional strings.')

        if before and not allman:
            if delim[0] is not None:
                self.emit('{} {}'.format(before, delim[0]))
            else:
                self.emit(before)
        else:
            if before:
                self.emit(before)
            if delim[0] is not None:
                self.emit(delim[0])

        with self.indent(dent):
            yield

        if delim[1] is not None:
            self.emit(delim[1] + after)
        else:
            self.emit(after)