Builds actual pillar data structure and updates the ``pillar`` variable

def _external_pillar_data(self, pillar, val, key):
        '''
        Builds actual pillar data structure and updates the ``pillar`` variable
        '''
        ext = None
        args = salt.utils.args.get_function_argspec(self.ext_pillars[key]).args

        if isinstance(val, dict):
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id, pillar,
                    extra_minion_data=self.extra_minion_data, **val)
            else:
                ext = self.ext_pillars[key](self.minion_id, pillar, **val)
        elif isinstance(val, list):
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id, pillar, *val,
                    extra_minion_data=self.extra_minion_data)
            else:
                ext = self.ext_pillars[key](self.minion_id,
                                            pillar,
                                            *val)
        else:
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id,
                    pillar,
                    val,
                    extra_minion_data=self.extra_minion_data)
            else:
                ext = self.ext_pillars[key](self.minion_id,
                                            pillar,
                                            val)
        return ext