Scala port for py-clave