def mac_to_bytes(addr):
    """ Covert Mac address to a bytes. """
    if (isinstance(addr, bytes)):
        addr = addr.decode()
    val = [int(v, 16) for v in addr.encode("utf-8").decode().split(':')]
    return bytearray(val)