def remove_common_elements(a, b): """Removes the common elements from both supplied lists (in place), doesnt not return a new list""" for e in a[:]: if e in b: a.remove(e) b.remove(e) def get_ip(request): if request.headers.getlist("X-Forwarded-For"): return request.headers.getlist("X-Forwarded-For")[0] else: return request.remote_addr