Preparation of guanidine or its derivatives