code: def dump(self, msg, fn_):
          '''
          Serialize the correct data into the named file object
          '''
          if six.PY2:
              fn_.write(self.dumps(msg))
          else:
              # When using Python 3, write files in such a way
              # that the 'bytes' and 'str' types are distinguishable
              # by using "use_bin_type=True".
              fn_.write(self.dumps(msg, use_bin_type=True))
          fn_.close(f dump(self, msg, fn_):
          '''
          Serialize the correct data into the named file object
          '''
          if six.PY2:
              fn_.write(self.dumps(msg))
          else:
              # When using Python 3, write files in such a way
              # that the 'bytes' and 'str' types are distinguishable
              # by using "use_bin_type=True".
              fn_.write(self.dumps(msg, use_bin_type=True))
          fn_.close()
docs: Serialize the correct data into the named file object