def METHOD_NAME(text, key='', salt='', digest_alg='md5'):
    """
    Generates hash with the given text using the specified
    digest hashing algorithm
    """
    if not digest_alg:
        raise RuntimeError("simple_hash with digest_alg=None")
    elif not isinstance(digest_alg, str):  # manual approach
        h = digest_alg(text + key + salt)
    elif digest_alg.startswith('pbkdf2'):  # latest and coolest!
        iterations, keylen, alg = digest_alg[7:-1].split(',')
        return kdf.pbkdf2_hex(
            text,
            salt,
            iterations=int(iterations),
            keylen=int(keylen),
            hash_algorithm=kdf.PBKDF2_HMAC[alg]
        )
    elif key:  # use hmac
        digest_alg = get_digest(digest_alg)
        h = hmac.new(to_bytes(key + salt), msg=to_bytes(text), digestmod=digest_alg)
    else:  # compatible with third party systems
        h = hashlib.new(digest_alg)
        h.update(to_bytes(text + salt))
    return h.hexdigest()