code: def bind_filter(self, direction, filter_name):
          
  
          if direction not in self._dynamips_direction:
              raise DynamipsError("Unknown direction {} to bind filter {}:".format(direction, filter_name))
          dynamips_direction = self._dynamips_direction[direction]
  
          yield from self._hypervisor.send("nio bind_filter {name} {direction} {filter}".format(name=self._name,
                                                                                                direction=dynamips_direction,
                                                                                                filter=filter_name))
  
          if direction == "in":
              self._input_filter = filter_name
          elif direction == "out":
              self._output_filter = filter_name
          elif direction == "both":
              self._input_filter = filter_name
              self._output_filter = filter_name
docs: Adds a packet filter to this NIO.
          Filter "freq_drop" drops packets.
          Filter "capture" captures packets.
  
          :param direction: "in", "out" or "both"
          :param filter_name: name of the filter to apply