def generate_hash(self, data):
    pattern = '[0-9a-zA-Z]+'
    objectStr = pickle.dumps(data)
    while True:
        id_hash = hashlib.sha256(objectStr).hexdigest()
        if re.match(pattern, id_hash):
            return id_hash
def generate_hash(self, data):
    pattern = '[0-9a-zA-Z]+'
    objectStr = pickle.dumps(data)
    while True:
        id_hash = hashlib.sha256(objectStr).hexdigest()
        if re.match(pattern, id_hash):
            return id_hash