<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def instantiate_component(self, component, callback=None):
 """ Instantiates given Component. Usage:: True True <tests_component_a.TestsComponentA object at 0x17a5b90> :param component: Component to instantiate. :type component: unicode :param callback: Callback object. :type callback: object """


        profile = self.__components[component]
        callback and callback(profile)

        LOGGER.debug("> Current Component: '{0}'.".format(component))

        if os.path.isfile(os.path.join(profile.directory, profile.package) + ".py") or \
                os.path.isdir(os.path.join(profile.directory, profile.package)):
            path = profile.directory
        elif os.path.basename(profile.directory) == profile.package:
            path = os.path.join(profile.directory, "..")
        not path in sys.path and sys.path.append(path)

        profile.module = __import__(profile.package)
        object = profile.attribute in profile.module.__dict__ and getattr(profile.module, profile.attribute) or None
        if object and inspect.isclass(object):
            instance = object(name=profile.name)
            for category, type in self.__categories.iteritems():
                if type.__name__ in (base.__name__ for base in object.__bases__):
                    profile.category = category
                    profile.interface = instance
                    LOGGER.info("{0} | '{1}' Component has been instantiated!".format(
                        self.__class__.__name__, profile.name))
                    return True
        else:
            del (self.__components[component])
            raise manager.exceptions.ComponentInterfaceError(
                "{0} | '{1}' Component has no Interface and has been rejected!".format(self.__class__.__name__,
                                                                                       profile.name))