<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cmd_b64(f, do_decode):
 """ Encodes or decode data in base64, just like the command base64. \b $ echo awesome | habu.b64 YXdlc29tZQo= \b $ echo YXdlc29tZQo= | habu.b64 -d awesome """


    data = f.read()

    if not data:
        print("Empty file or string!")
        return 1

    if do_decode:
        os.write(sys.stdout.fileno(), base64.b64decode(data))
    else:
        os.write(sys.stdout.fileno(), base64.b64encode(data))