<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_filestore_instance(img_dir=None, data_dir=None):
 """Return an instance of FileStore."""

    global _filestore_instances

    key = "%s:%s" % (img_dir, data_dir)

    try:
        instance = _filestore_instances[key]
    except KeyError:
        instance = FileStore(
            img_dir=img_dir, data_dir=data_dir
        )
        _filestore_instances[key] = instance

    return instance