def _formatparam(param, value=None, quote=True):
 if ((value is not None) and (len(value) > 0)):
  if isinstance(value, tuple):
   param += '*'
   value = utils.encode_rfc2231(value[2], value[0], value[1])
  if (quote or tspecials.search(value)):
   return ('%s="%s"' % (param, utils.quote(value)))
  else:
   return ('%s=%s' % (param, value))
 else:
  return param

def _formatparam ( param , value = None , quote = True ) : if ( ( value is not None ) and ( len ( value ) > 0 ) ) : if isinstance ( value , tuple ) : param += '*' value = utils . encode_rfc2231 ( value [ 2 ] , value [ 0 ] , value [ 1 ] ) if ( quote or tspecials . search ( value ) ) : return ( '%s="%s"' % ( param , utils . quote ( value ) ) ) else : return ( '%s=%s' % ( param , value ) ) else : return param
convenience function to format and return a key=value pair .