Handle a block. The current state of the parser should be after the
        open block is completed:
            {% blk foo %}my data {% endblk %}
                         ^ right here

def handle_block(self, match, block_start=None):
        """Handle a block. The current state of the parser should be after the
        open block is completed:
            {% blk foo %}my data {% endblk %}
                         ^ right here
        """
        # we have to handle comments inside blocks because you could do this:
        # {% blk foo %}asdf {# {% endblk %} #} {%endblk%}
        # they still end up in the data/raw_data of the block itself, but we
        # have to know to ignore stuff until the end comment marker!
        found = BlockTag(**match.groupdict())
        # the full block started at the given match start, which may include
        # prefixed whitespace! we'll strip it later
        if block_start is None:
            block_start = match.start()

        self._block_contents = ''

        # you can have as many comments in your block as you'd like!
        while True:
            match = self._expect_match(
                '"{}"'.format(found.end_block_type_name),
                found.end_pat(), COMMENT_START_PATTERN, RAW_START_PATTERN,
                regex('''(?P<quote>(['"]))''')
            )
            groups = match.groupdict()
            if groups.get('endblock') is not None:
                break

            self.advance(match.end())

            if groups.get('comment_start') is not None:
                self.expect_comment_end()
            elif groups.get('raw_start') is not None:
                self.expect_raw_end()
            elif groups.get('quote') is not None:
                self.rewind()
                match = self._expect_match('any string', STRING_PATTERN)
                self.advance(match.end())
            else:
                raise dbt.exceptions.InternalException(
                    'unhandled regex in handle_block, no match: {}'
                    .format(groups)
                )

        # we want to advance to just the end tag at first, to extract the
        # contents
        self.advance(match.start())
        found.contents = self._block_contents
        self._block_contents = None
        # now advance to the end
        self.advance(match.end())
        found.full_block = self.data[block_start:self.pos]
        return found