def decode(bstr):
    """
  Decodes an ASCII encoded binary MAC address tring into a number.
  """
    bstr = bstr.replace(b':', b'')
    if len(bstr) != 12:
        raise ValueError('not a valid MAC address: {!r}'.format(bstr))
    try:
        return int(bstr, 16)
    except ValueError:
        raise ValueError('not a valid MAC address: {!r}'.format(bstr))
