<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_key(key_path):
 """ Validate a key :param key_path: path to a key to use for authentication :type key_path: str :return: key object used for authentication :rtype: paramiko.RSAKey """


    key_path = os.path.expanduser(key_path)

    if not os.path.isfile(key_path):
        return False

    return paramiko.RSAKey.from_private_key_file(key_path)