<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def open_sciobj_file_by_path(abs_path, write=False):
 """Open a SciObj file for read or write. If opened for write, create any missing directories. For a SciObj stored in the default SciObj store, the path includes the PID hash based directory levels. This is the only method in GMN that opens SciObj files, so can be modified to customize the SciObj storage locations and can be mocked for testing. Note that when a SciObj is created by a client via MNStorage.create(), Django streams the SciObj bytes to a temporary file or memory location as set by ``FILE_UPLOAD_TEMP_DIR`` and related settings. """

    if write:
        d1_common.utils.filesystem.create_missing_directories_for_file(abs_path)
    return open(abs_path, 'wb' if write else 'rb')