<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) : """Creates a hash index if it does not already exist, and returns it"""

        data = {
            "type" : "hash",
            "fields" : fields,
            "unique" : unique,
            "sparse" : sparse,
            "deduplicate": deduplicate
        }
        ind = Index(self, creationData = data)
        self.indexes["hash"][ind.infos["id"]] = ind
        return ind