parameters: (bandwidth)
return_statement: return bw
docstring: Return bits per second represented by dummynet bandwidth option.
  
    See ipfw/dummynet.c:read_bandwidth for how it is really done.
  
    Args:
      bandwidth: a dummynet-style bandwidth specification (e.g. "10Kbit/s")
docstring_summary: Return bits per second represented by dummynet bandwidth option.
docstring_tokens: Return bits per second represented by dummynet bandwidth option .
function: def GetBitsPerSecond(bandwidth):
    """Return bits per second represented by dummynet bandwidth option.
  
    See ipfw/dummynet.c:read_bandwidth for how it is really done.
  
    Args:
      bandwidth: a dummynet-style bandwidth specification (e.g. "10Kbit/s")
    """
    if bandwidth == '0':
      return 0
    bw_re = r'^(\d+)(?:([KM])?(bit|Byte)/s)?$'
    match = re.match(bw_re, str(bandwidth))
    if not match:
      raise BandwidthValueError('Value, "%s", does not match regex: %s' % (
          bandwidth, bw_re))
    bw = int(match.group(1))
    if match.group(2) == 'K':
      bw *= 1000
    if match.group(2) == 'M':
      bw *= 1000000
    if match.group(3) == 'Byte':
      bw *= 8
    return bw
function_tokens: def GetBitsPerSecond ( bandwidth ) : if bandwidth == '0' : return 0 bw_re = r'^(\d+)(?:([KM])?(bit|Byte)/s)?$' match = re . match ( bw_re , str ( bandwidth ) ) if not match : raise BandwidthValueError ( 'Value, "%s", does not match regex: %s' % ( bandwidth , bw_re ) ) bw = int ( match . group ( 1 ) ) if match . group ( 2 ) == 'K' : bw *= 1000 if match . group ( 2 ) == 'M' : bw *= 1000000 if match . group ( 3 ) == 'Byte' : bw *= 8 return bw