How to check for file handle for files and which process is modifying the file in real time using python on Windows?

Currently, we are working on a Malware detection project specifically Ransomware detection. We are monitoring specific files, and we want to identify file handles and which processes are opening the files.

Our Environment consists of python 2.7 and python 3.0. The operating systems we used are Windows XP, Windows 2008 R2, Windows 7 & 8

Our expected results is to identify the specific processes that are reading file handle, so we can kill the processes.

How can we write this part of code in python?