'Register a plugin.
:param plugin_class: The plugin factory.
:param string name: Name of the plugin (if not given, default to factory class name in underscore form).
:param list interfaces: Interfaces this plugin implements.
:param bool builtin: Auto-activated?
:param bool debug: True if plugin is for debugging purposes.
:param int api_ver: Signature of callback hooks (1=task; 2=task,config).
:param string category: The type of plugin. Can be one of the task phases.
Defaults to the package name containing the plugin.
:param groups: DEPRECATED'

def __init__(self, plugin_class, name=None, interfaces=None, builtin=False, debug=False, api_ver=1, category=None, groups=None):

    dict.__init__(self)
    if (interfaces is None):
        interfaces = [u'task']
    if (groups is not None):
        warnings.warn((u'The    `groups`    argument    for    plugin    registration    is    deprecated.    `interfaces`    should    be    used    instead.    Plugin    %s' % name), DeprecationWarning, stacklevel=2)
        interfaces.extend(groups)
    if (name is None):
        name = re.sub(u'[A-Z]+', (lambda i: (u'_' + i.group(0).lower())), plugin_class.__name__).lstrip(u'_')
    if ((category is None) and plugin_class.__module__.startswith(u'flexget.plugins')):
        category = plugin_class.__module__.split(u'.')[(-2)]
    if (api_ver < 2):
        warnings.warn((u'Api    versions    <2    are    no    longer    supported.    Plugin    %s' % name), DeprecationWarning, stacklevel=2)
    self.api_ver = api_ver
    self.name = name
    self.interfaces = interfaces
    self.builtin = builtin
    self.debug = debug
    self.category = category
    self.phase_handlers = {}
    self.plugin_class = plugin_class
    self.instance = None
    if (self.name in plugins):
        PluginInfo.dupe_counter += 1
        log.critical(u'Error    while    registering    plugin    %s.    A    plugin    with    the    same    name    is    already    registered', self.name)
    else:
        plugins[self.name] = self
