code: def wrap(self, filename, boxes=None):
          
          if boxes is None:
              boxes = self._get_default_jp2_boxes()
  
          self._validate_jp2_box_sequence(boxes)
  
          with open(filename, 'wb') as ofile:
              for box in boxes:
                  if box.box_id != 'jp2c':
                      box.write(ofile)
                  else:
                      self._write_wrapped_codestream(ofile, box)
              ofile.flush()
  
          jp2 = Jp2k(filename)
          return jp2
docs: Create a new JP2/JPX file wrapped in a new set of JP2 boxes.
  
          This method is primarily aimed at wrapping a raw codestream in a set of
          of JP2 boxes (turning it into a JP2 file instead of just a raw
          codestream), or rewrapping a codestream in a JP2 file in a new "jacket"
          of JP2 boxes.
  
          Parameters
          ----------
          filename : str
              JP2 file to be created from a raw codestream.
          boxes : list
              JP2 box definitions to define the JP2 file format.  If not
              provided, a default ""jacket" is assumed, consisting of JP2
              signature, file type, JP2 header, and contiguous codestream boxes.
              A JPX file rewrapped without the boxes argument results in a JP2
              file encompassing the first codestream.
  
          Returns
          -------
          Jp2k
              Newly wrapped Jp2k object.
  
          Examples
          --------
          >>> import glymur, tempfile
          >>> jfile = glymur.data.goodstuff()
          >>> j2k = glymur.Jp2k(jfile)
          >>> tfile = tempfile.NamedTemporaryFile(suffix='jp2')
          >>> jp2 = j2k.wrap(tfile.name)