generally tidy up the Python code; make it more idiomatic; split out photo lookup backend