<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_by_id(key: str, user: str=None) -> Optional['ApiKey']: """ Get API key details. """

        return ApiKey.from_db(db.get_key(key, user))