<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, strm, delim, verbose=False):
 """ Write this data frame to a stream or file. :param strm: stream to write to; can also be a string, in which case we treat it as a filename and to open that file for writing to. :param delim: delimiter to use between columns. :param verbose: if True, output progress messages to stderr. """

    if verbose:
      sys.stderr.write("outputing...\n")

    # figure out whether we need to open a file or not
    out_strm = strm
    if isinstance(out_strm, basestring):
      out_strm = open(out_strm)

    if self.header is not None:
      out_strm.write(delim.join(self.header))
    max_col_len = len(max(self.frame, key=len))
    for i in range(0, max_col_len):
      for j in range(0, len(self.frame)):
        if j != 0:
          out_strm.write(delim)
        out_strm.write(str(self.frame[j][i]))
      out_strm.write("\n")