Python script for scanning