def maybe_delivery_mode(v, modes=DELIVERY_MODES, default=PERSISTENT_DELIVERY_MODE):
 if v:
  return (v if isinstance(v, numbers.Integral) else modes[v])
 return default

def maybe_delivery_mode ( v , modes = DELIVERY_MODES , default = PERSISTENT_DELIVERY_MODE ) : if v : return ( v if isinstance ( v , numbers . Integral ) else modes [ v ] ) return default
get delivery mode by name .