<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_api_key_from_file(path, set_global=True):
 """Set the global api_key from a file path."""

    with open(path, 'r+b') as f:
        global api_key
        api_key = f.read().strip()
    return api_key