code: def output_latex(self, filename_or_file_handle):
          
  
          if isinstance(filename_or_file_handle, basestring):
              file_handle = file(filename_or_file_handle, 'w')
              we_opened = True
          else:
              file_handle = filename_or_file_handle
              we_opened = False
  
          try:
              file_handle.write(self.latex)
          finally:
              if we_opened:
                  file_handle.close()
docs: Output the file to a latex document
          :param filename_or_file_handle: filename or already opened file handle to output to
          :return: