def mkDevice(screen, x, y, id): if id.isdigit(): subnet = Subnet(screen, x, y) subnet.IP = IP(int(id)) return subnet elif id == "N": dns = DNS(screen, x, y) dns.IP = str(ord(list(id)[0])) return dns elif id.isupper(): router = Router(screen, x, y) router.IP = str(ord(list(id)[0])) router.selected = router.IP == "66" return router elif id.islower(): if id == "h": host = Client(screen, x, y) host.name = "Alice" host.corespondent = "Bob" elif id == "x": host = Client(screen, x, y) host.name = "Bob" host.corespondent = "Alice" else: host = Host(screen, x ,y) host.IP = str(ord(list(id)[0])) return host else: print "Unrecognized unique identifier in sprite map" return None