def METHOD_NAME(self, filename):
    """
    Saves the figure to the supplied filename.
    Args:
        filenmae[str]: A pdf/png/py file to export.
    """
    if filename.endswith('.py'):
        self.parent().write(filename)
    else:
        self._figure.savefig(filename)