def initiate_sniff(self, initial=False):
if self.sniffing_task and self.sniffing_task.done():<EOL><INDENT>try:<EOL><INDENT>if self.sniffing_task is not None:<EOL><INDENT>self.sniffing_task.result()<EOL><DEDENT><DEDENT>except:<EOL><INDENT>if self.raise_on_sniff_error:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self.sniffing_task = None<EOL><DEDENT><DEDENT>if self.sniffing_task is None:<EOL><INDENT>self.sniffing_task = ensure_future(self.sniff_hosts(initial), loop=self.loop)<EOL><DEDENT>
Initiate a sniffing task. Make sure we only have one sniff request
running at any given time. If a finished sniffing request is around,
collect its result (which can raise its exception).