code: def capture(self, tunnel_addr, tunnel_port, filename=None,
                  bucket=None, destination=None):
          
          if filename is None:
              raise MemoryCaptureAttributeMissingError('filename')
          if destination == OutputDestinations.local:
              logger.info("{0}: dumping to file://{1}".format(self.remote_addr,
                                                              filename))
              result = self.to_file(filename, tunnel_addr, tunnel_port)
          elif destination == OutputDestinations.s3:
              if bucket is None:
                  raise MemoryCaptureAttributeMissingError('bucket')
              logger.info(("{0}: dumping memory to s3://{1}/"
                           "{2}".format(self.remote_addr, bucket, filename)))
              result = self.to_s3(bucket, filename, tunnel_addr, tunnel_port)
          else:
              raise MemoryCaptureOutputMissingError(self.remote_addr)
  
          return result
docs: Captures memory based on the provided OutputDestination
  
          :type tunnel_addr: str
          :param tunnel_port: ssh tunnel hostname or ip
          :type tunnel_port: int
          :param tunnel_port: ssh tunnel port
          :type filename: str
          :param filename: memory dump output filename
          :type bucket: str
          :param bucket: output s3 bucket
          :type destination: :py:class:`margaritashotgun.memory.OutputDestinations`
          :param destination: OutputDestinations member