from collections import namedtuple LocationData = namedtuple('LocationData', 'hwid lat lon eig prec yaw press timestamp') def have_location(x): return x.lat != None and x.lon != None def maybe_entry(x): return x.eig < 5 and (x.prec > 40 or x.prec < 0) def maybe_indoor(x): return x.eig < 1 and (x.prec > 400 or x.prec < 0)