Generalized to accept a file argument as a key.