Mac_changer.py error in the regex extraction

I am working on the python course with zaid so far i have reached the section on “Extracting a substring using Regex”
my code reads:
#!/usr/bin/env python

import subprocess
import optparse
import re


def get_arguments():
parser = optparse.OptionParser()
parser.add_option("-i", "--interface", dest="interface", help="interface to change its MAC address")
parser.add_option("-m", "--mac", dest="new_mac", help="New MAC address")
(options, arguments) = parser.parse_args()
if not options.interface:
    parser.error("[-] please specify an interface, use --help for more info")
elif not options.new_mac:
    parser.error("[-] please specify a MAC, use --help for more info")
return options


def change_mac(interface, new_mac):
subprocess.call(["sudo", "ifconfig", interface, "down"])
subprocess.call(["sudo", "ifconfig", interface, "hw", "ether", new_mac])
subprocess.call(["sudo", "ifconfig", interface, "up"])
print("[+] Changing MAC address for " + interface + " to " + new_mac)


options = get_arguments()
change_mac(options.interface, options.new_mac)

 ifconfig_result = subprocess.check_output(["ifconfig", options.interface])
print(ifconfig_result)
mac_address_search_result = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w", ifconfig_result)
print(mac_address_search_result.group(0))

as far as i can see in the tutorial this is how it is supposed to be but i am getting an error from the “re.py” file as follows:
Traceback (most recent call last):
File “mac_changer.py”, line 32, in
mac_address_search_result = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w", ifconfig_result)
File “/usr/lib/python3.8/re.py”, line 201, in search
return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

i did look at some google posts about this type of error but i couldnt find anything of much use to the mac changer i am building from them mostly stuff to do with link extraction can anyone please see why this error is happening thanks in advanced.

I found my ERROR despite having looke several times well i missed the fact that now i notice that i had not coppied the code properly,
on line 32 i was missing a small piece like this
:\w\w
this simply made my error and unpredicable result
also on line 30 i needed to add to the end of the line

.decode('utf-8')

this is not in the tutorial video so maybe if possible can someone that know more about python3 explane for me why i needed to use this thanks in advance

There is a huge difference between python 2 and python 3. Python 2 considered both byte-string and normal string as equal but in python 3 these two are not equal that’s why we have to explicitly state the format

ah so the biggest part of my error will be coming from calling the file as python3 mac_changer.py

and i just found that within a couple of lectures that this explanation is fully explaned for me thanks @Apurv-StationX