"""Set 01 - Challenge 01."""
import base64

hex_string = ('49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f'
              '69736f6e6f7573206d757368726f6f6d')
b64_string = b'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t'

def hex2b64(hex_string):
    """Convert a hex string into a base64 encoded byte string."""
    hex_data = bytearray.fromhex(hex_string)
    # Strip trailing newline
    return base64.encodebytes(hex_data)[:-1]

assert hex2b64(hex_string) == b64_string

@@ -26,16 +26,17 @@
 %22%22%22%0A
+%0A
 import b
 ase6
@@ -31,21 +31,23 @@
 import b
-ase64
+inascii
 %0A%0Ahex_st
@@ -184,17 +184,16 @@
 tring = 
-b
 'SSdtIGt
@@ -331,13 +331,8 @@
 ded 
-byte 
 stri
@@ -346,122 +346,72 @@
     
-hex_data = bytearray.fromhex(hex_string)%0A    # Strip trailing newline%0A    return base64.encodebytes(hex_data)%5B:-1%5D
+return binascii.b2a_base64(binascii.a2b_hex(hex_string)).strip()
 %0A%0Aas

Revert "Updated function to work on bytes rather than binascii functions."