def get_img_attrs(self, style=None, **kwargs):
        """ Get an attribute list (src, srcset, style, et al) for the image.

        style -- an optional list of CSS style fragments

        Returns: a dict of attributes e.g. {'src':'foo.jpg','srcset':'foo.jpg 1x, bar.jpg 2x']
        """

        add = {}
        if 'prefix' in kwargs:
            attr_prefixes = kwargs.get('prefix')
            if isinstance(kwargs['prefix'], str):
                attr_prefixes = [attr_prefixes]

            for prefix in attr_prefixes:
                for k, val in kwargs.items():
                    if k.startswith(prefix):
                        add[k[len(prefix):]] = val

        return self._get_img_attrs(style, {**kwargs, **add})
def get_img_attrs ( self , style = None , ** kwargs ) : add = { } if 'prefix' in kwargs : attr_prefixes = kwargs . get ( 'prefix' ) if isinstance ( kwargs [ 'prefix' ] , str ) : attr_prefixes = [ attr_prefixes ] for prefix in attr_prefixes : for k , val in kwargs . items ( ) : if k . startswith ( prefix ) : add [ k [ len ( prefix ) : ] ] = val return self . _get_img_attrs ( style , { ** kwargs , ** add } )
Get an attribute list (src, srcset, style, et al) for the image.

        style -- an optional list of CSS style fragments

        Returns: a dict of attributes e.g. {'src':'foo.jpg','srcset':'foo.jpg 1x, bar.jpg 2x']