human
Complete the below
def externalize(taskclass_or_taskobject):

    ''''Returns an externalized version of a Task. You may both pass an
    instantiated task object or a task class. Some examples:
    .. code-block:: python
    class RequiringTask(luigi.Task):
    def requires(self):
    task_object = self.clone(MyTask)
    return externalize(task_object)
    Here\'s mostly equivalent code, but ``externalize`` is applied to a task
    class instead.
    .. code-block:: python
    @luigi.util.requires(externalize(MyTask))
    class RequiringTask(luigi.Task):
    pass
    Of course, it may also be used directly on classes and objects (for example
    for reexporting or other usage).
    .. code-block:: python
    MyTask = externalize(MyTask)
    my_task_2 = externalize(MyTask2(param=\'foo\'))
    If you however want a task class to be external from the beginning, you\'re
    better off inheriting :py:class:`ExternalTask` rather than :py:class:`Task`.
    This function tries to be side-effect free by creating a copy of the class
    or the object passed in and then modify that object. In particular this
    code shouldn\'t do anything.
    .. code-block:: python
    externalize(MyTask)  # BAD: This does nothing (as after luigi 2.4.0)'
    '''
assistant
#Here is the Python code you requested.
    compatible_copy = (copy.copy if six.PY3 else copy.deepcopy)
    copied_value = compatible_copy(taskclass_or_taskobject)
    if (copied_value is taskclass_or_taskobject):
        clazz = taskclass_or_taskobject
        @_task_wraps(clazz)
        class _CopyOfClass(clazz, ):
            _visible_in_registry = False
        _CopyOfClass.run = None
        return _CopyOfClass
    else:
        copied_value.run = None
        return copied_value