def code_to_text(self):
        """Return the text representation of a code cell"""
        source = copy(self.source)
        comment_magic(source, self.language, self.comment_magics)

        options = []
        if self.cell_type == 'code' and self.language:
            options.append(self.language)

        filtered_metadata = {key: self.metadata[key] for key in self.metadata
                             if key not in ['active', 'language']}

        if filtered_metadata:
            options.append(metadata_to_md_options(filtered_metadata))

        return ['```{}'.format(' '.join(options))] + source + ['```']