find d star pattern in python