import binascii


def mac_str_to_bytes(mac):
    """Converts string representation of a MAC address to bytes"""
    if isinstance(mac, bytes):
        return mac
    if not isinstance(mac, str):
        raise TypeError('MAC address given must be a string')
    mac = mac.replace(':', '').replace('-', '').replace('.', '')
    return binascii.unhexlify(mac)