def checkLocation(self, startTime, endTime, context, dataLocations):
        if dataLocations is None:
            dataLocations = set()
            cursor = self.ids.getData("LocationProbe", startTime, endTime)
            if cursor:
                for entry in cursor:
                    dataLocations.add((entry[u'value'][u'mlatitude'], entry[u'value'][u'mlongitude']))

        contextLocations = set()
        temp_places = [x.strip() for x in context.context_places[1:-1].split("lat/lng:") if x]        

        #No location specified in the context, alright to use the data.
        if len(temp_places) == 0:
            return True

        contextLocations = []
        for place in temp_places:
            if '),' in place:
                placeValues = [float(x.strip()) for x in place[:-1][1:-1].split(',')]
            else:
                placeValues = [float(x.strip()) for x in place[1:-1].split(',')]
            contextLocations.append((placeValues[0], placeValues[1]))
        
        dataLocationsChecks = [0] * len(dataLocations)
        dataLocationsIndex = 0

        #Haversine distance computation.
        #Source: http://rosettacode.org/wiki/Haversine_formula#Python
        R = 6372.8 # Earth radius in kilometers
        for dataLocation in dataLocations:
            for contextLocation in contextLocations:
                dLat = math.radians(contextLocation[0] - dataLocation[0])
                dLon = math.radians(dataLocation[1] - contextLocation[1])
                lat1 = math.radians(contextLocation[0])
                lat2 = math.radians(dataLocation[0])
        
                a = math.sin(dLat/2)**2 + math.cos(lat1)*math.cos(lat2)*math.sin(dLon/2)**2
                c = 2*math.asin(math.sqrt(a))

                distance = R * c * 1000
                if distance < 500:
                    dataLocationsChecks[dataLocationsIndex] = 1
                    break
            dataLocationsIndex += 1

        if all(check == 1 for check in dataLocationsChecks):
            return True        
        else:
            return False
dataset/ETHPy150Open HumanDynamics/openPDS/openpds/accesscontrol/internal.py/AccessControlledInternalDataStore.checkLocation/swapped operands of `-`