'Using ssl.wrap_socket to create a socket, gives a security hotspot in security scanner

The scanner is highlighting the below line as security hotspot.

mysocket = ssl.wrap_socket(http_server.socket, keyfile=self.keyfile, certfile=self.certFile, server_side=True)

Is this code secure or there is a chance of MITM Attack, can someone explain the secure method of using wrap_socket.

PS: I read that the ssl.wrap_socket has been deprecated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source