Update getData.py

Converted to function