def master_encode(strng: str) -> bytes:
    '\n    Encodes a string to its leet equivalent (sans punctuation) which when\n    base64 encoded contains only base32 characters\n    '
    if isinstance(strng, (bytes, bytearray)):
        strng = strng.decode()
    strng = transform(strng)
    result = ''
    i = 0
    while (i < len(strng)):
        try:
            current = strng[i:(i + 3)]
            if (current in NON_LEET):
                if ((current[:2] + ' ') not in NON_LEET):
                    result += valid_variation((current[:2] + ' '))
                    i += 2
                elif ((current[0] + '  ') not in NON_LEET):
                    result += valid_variation((current[0] + '  '))
                    i += 1
                elif (' {} '.format(current[0]) not in NON_LEET):
                    result += valid_variation(' {} '.format(current[0]))
                    i += 1
                elif ('  {}'.format(current[0]) not in NON_LEET):
                    result += valid_variation('  {}'.format(current[0]))
                    i += 1
                else:
                    i += 1
            else:
                result += valid_variation(current)
                i += 3
        except TypeError:
            i += 1
    return b64encode(result.encode())
Encodes a string to its leet equivalent (sans punctuation) which when
base64 encoded contains only base32 characters
def master_encode(strng: str) -> bytes:
    '\n    Encodes a string to its leet equivalent (sans punctuation) which when\n    base64 encoded contains only base32 characters\n    '
    if isinstance(strng, (bytes, bytearray)):
        strng = strng.decode()
    strng = transform(strng)
    result = 
    i = 0
    while (i < len(strng)):
        try:
            current = strng[i:(i + 3)]
            if (current in NON_LEET):
                if ((current[:2] + ' ') not in NON_LEET):
                    result += valid_variation((current[:2] + ' '))
                    i += 2
                elif ((current[0] + '  ') not in NON_LEET):
                    result += valid_variation((current[0] + '  '))
                    i += 1
                elif (' {} '.format(current[0]) not in NON_LEET):
                    result += valid_variation(' {} '.format(current[0]))
                    i += 1
                elif ('  {}'.format(current[0]) not in NON_LEET):
                    result += valid_variation('  {}'.format(current[0]))
                    i += 1
                else:
                    i += 1
            else:
                result += valid_variation(current)
                i += 3
        except TypeError:
            i += 1
    return b64encode(result.encode())