Python 3 Write Function From Table