@register.assignment_tag
def shipping_charge(method, basket):
 return method.calculate(basket)

@ register . assignment_tag def shipping_charge ( method , basket ) : return method . calculate ( basket )
template tag for calculating the shipping charge for a given shipping method and basket .