PySpark: What is the use of the getOrCreate() method?

The getOrCreate() method is used to initialise a SparkContext. If a SparkContext is already present, then it returns that SparkContext; otherwise, it creates a new SparkContext.