def create_enhanced_plugin_builder(compulsory_objects=None,<EOL>optional_objects=None,<EOL>other_data=None):
from invenio_utils.washers import wash_urlargd<EOL>def plugin_builder(the_plugin):<EOL><INDENT>"""<STR_LIT>"""<EOL>plugin_name = the_plugin.__name__<EOL>plugin = {}<EOL>if compulsory_objects:<EOL><INDENT>for object_name, object_signature initeritems(compulsory_objects):<EOL><INDENT>the_object = getattr(the_plugin, object_name, None)<EOL>if the_object is None:<EOL><INDENT>raise AutodiscoveryError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(plugin_name, object_name))<EOL><DEDENT>try:<EOL><INDENT>check_signature(object_name, the_object, object_signature)<EOL><DEDENT>except AutodiscoveryError as err:<EOL><INDENT>raise AutodiscoveryError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(plugin_name, object_name, err))<EOL><DEDENT>plugin[object_name] = the_object<EOL><DEDENT><DEDENT>if optional_objects:<EOL><INDENT>for object_name, object_signature in iteritems(optional_objects):<EOL><INDENT>the_object = getattr(the_plugin, object_name, None)<EOL>if the_object is not None:<EOL><INDENT>try:<EOL><INDENT>check_signature(<EOL>object_name,<EOL>the_object,<EOL>object_signature)<EOL><DEDENT>except AutodiscoveryError as err:<EOL><INDENT>raise AutodiscoveryError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(plugin_name, object_name, err))<EOL><DEDENT>plugin[object_name] = the_object<EOL><DEDENT><DEDENT><DEDENT>if other_data:<EOL><INDENT>the_other_data = {}<EOL>for data_name, (dummy, data_default) in iteritems(other_data):<EOL><INDENT>the_other_data[data_name] = getattr(the_plugin, data_name,<EOL>data_default)<EOL><DEDENT>try:<EOL><INDENT>the_other_data = wash_urlargd(the_other_data, other_data)<EOL><DEDENT>except Exception as err:<EOL><INDENT>raise AutodiscoveryError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(plugin_name, err))<EOL><DEDENT>plugin.update(the_other_data)<EOL><DEDENT>return plugin<EOL><DEDENT>return plugin_builder<EOL>
Creates a plugin builder function suitable to extract some specific
objects (either compulsory or optional) and other simpler data

>>> def dummy_needed_funct1(foo, bar):
...     pass
>>> class dummy_needed_class1:
...     def __init__(self, baz):
...         pass
>>> def dummy_optional_funct2(boo):
...     pass
>>> create_enhanced_plugin_builder(
...    compulsory_objects={
...         'needed_funct1' : dummy_needed_funct1,
...         'needed_class1' : dummy_needed_class1
...     },
...     optional_objects={
...         'optional_funct2' : dummy_optional_funct2,
...     },
...     other_data={
...         'CFG_SOME_DATA' : (str, ''),
...         'CFG_SOME_INT' : (int, 0),
...     })
<function plugin_builder at 0xb7812064>

:param compulsory_objects: map of name of an object to look for inside
    the `plugin` and a *signature* for a class or callable. Every
    name specified in this map **must exists** in the plugin, otherwise
    the plugin will fail to load.
:type compulsory_objects: dict
:param optional_objects: map of name of an object to look for inside
    the C{plugin} and a I{signature} for a class or callable. Every
    name specified in this map must B{can exists} in the plugin.
:type optional_objects: dict
:param other_data: map of other simple data that can be loaded from
    the plugin. The map has the same format of the C{content}
    parameter of L{invenio_ext.legacy.handler.wash_urlargd}.
:type other_data: dict
:return: a I{plugin_builder} function that can be used with the
    map function. Such function will build the plugin
    in the form of a map, where every key is one of the keys inside
    the three maps provided as parameters and the corresponding value
    is the expected class or callable or simple data.