<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_private_key(key_file, key_password=None):
 """ Load a private key from disk. :param key_file: File path to key file. :param key_password: Optional. If the key file is encrypted, provide the password to decrypt it. Defaults to None. :return: PrivateKey<string> """

    key_file = os.path.expanduser(key_file)
    key_file = os.path.abspath(key_file)

    if not key_password:
        with open(key_file, 'r') as key:
            return key.read()

    with open(key_file, 'rb') as key:
        key_bytes = key.read()
    return decrypt_key(key_bytes, key_password).decode(ENCODING)