# Buggy code
def put_object(self, object_id, value):
    """Put value in the local object store with object id objectid.

    This assumes that the value for objectid has not yet been placed in the
    local object store.

    Args:
        object_id (object_id.ObjectID): The object ID of the value to be
            put.
        value: The value to put in the object store.

    Raises:
        Exception: An exception is raised if the attempt to store the
            object fails. This can happen if there is already an object
            with the same ID in the object store or if the object store is
            full.
    """
    # Make sure that the value is not an object ID.
    if isinstance(value, ray.local_scheduler.ObjectID):
        raise Exception(
            "Calling 'put' on an ObjectID is not allowed "
            "(similarly, returning an ObjectID from a remote "
            "function is not allowed). If you really want to "
            "do this, you can wrap the ObjectID in a list and "
            "call 'put' on it (or return it)."
        )

    if isinstance(value, ray.actor.ActorHandleParent):
        raise Exception(
            "Calling 'put' on an actor handle is currently "
            "not allowed (similarly, returning an actor "
            "handle from a remote function is not allowed)."
        )

    # Serialize and put the object in the object store.
    try:
        self.store_and_register(object_id, value)
    except pyarrow.PlasmaObjectExists as e:
        # The object already exists in the object store, so there is no
        # need to add it again. TODO(rkn): We need to compare the hashes
        # and make sure that the objects are in fact the same. We also
        # should return an error code to the caller instead of printing a
        # message.
        print("This object already exists in the object store.")


# Traceback (ImportError)
Traceback (most recent call last):
File "/home/ubuntu/ray/python/ray/worker.py", line 1694, in fetch_and_execute_function_to_run
function = pickle.loads(serialized_function)
File "/home/ubuntu/ray/python/ray/tune/registry.py", line 12, in <module>
from ray.tune.trainable import Trainable, wrap_function
File "/home/ubuntu/ray/python/ray/tune/__init__.py", line 6, in <module>
from ray.tune.tune import run_experiments
File "/home/ubuntu/ray/python/ray/tune/tune.py", line 8, in <module>
from ray.tune.hyperband import HyperBandScheduler
File "/home/ubuntu/ray/python/ray/tune/hyperband.py", line 8, in <module>
from ray.tune.trial_scheduler import FIFOScheduler, TrialScheduler
File "/home/ubuntu/ray/python/ray/tune/trial_scheduler.py", line 5, in <module>
from ray.tune.trial import Trial
File "/home/ubuntu/ray/python/ray/tune/trial.py", line 15, in <module>
from ray.tune.registry import _default_registry, get_registry, TRAINABLE_CLASS
ImportError: cannot import name '_default_registry'

# Fixed code
def put_object(self, object_id, value):
    """Put value in the local object store with object id objectid.

    This assumes that the value for objectid has not yet been placed in the
    local object store.

    Args:
        object_id (object_id.ObjectID): The object ID of the value to be
            put.
        value: The value to put in the object store.

    Raises:
        Exception: An exception is raised if the attempt to store the
            object fails. This can happen if there is already an object
            with the same ID in the object store or if the object store is
            full.
    """
    # Make sure that the value is not an object ID.
    if isinstance(value, ray.local_scheduler.ObjectID):
        raise Exception(
            "Calling 'put' on an ObjectID is not allowed "
            "(similarly, returning an ObjectID from a remote "
            "function is not allowed). If you really want to "
            "do this, you can wrap the ObjectID in a list and "
            "call 'put' on it (or return it)."
        )

    if isinstance(value, ray.actor.ActorHandleParent):
        raise Exception(
            "Calling 'put' on an actor handle is currently "
            "not allowed (similarly, returning an actor "
            "handle from a remote function is not allowed)."
        )

    # Serialize and put the object in the object store.
    try:
        self.store_and_register(object_id, value)
    except pyarrow.PlasmaObjectExists as e:
        # The object already exists in the object store, so there is no
        # need to add it again. TODO(rkn): We need to compare the hashes
        # and make sure that the objects are in fact the same. We also
        # should return an error code to the caller instead of printing a
        # message.
        print(
            "The object with ID {} already exists in the object store.".format(
                object_id
            )
        )