Implement the keys() function

fixes #7557