<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def valid_api_plugin(self, plugin):
 """ Validate an API plugin, ensuring it is an API plugin and has the necessary fields present. `plugin` is a subclass of scruffy's Plugin class. """

        if (issubclass(plugin, APIPlugin)       and
            hasattr(plugin, 'plugin_type')      and plugin.plugin_type == 'api' and
            hasattr(plugin, 'request')          and plugin.request != None and
            hasattr(plugin, 'request_class')    and plugin.request_class != None and
            hasattr(plugin, 'response_class')   and plugin.response_class != None):
            return True
        return False