from __future__ import print_function
try:
    input = raw_input
except NameError:
    pass

def get(msg,expected=[]):
    msg = '%s (help, exit) : ' % msg
    cmd = []
    while not cmd:
        cmd = input(msg).split(' ')
        if 'help' in cmd:
            print('you can try one of these cmd : %s'% ', '.join(expected))
            cmd = cmd.remove('help')
        elif 'exit' in cmd:
            print('you can still continue later')
            exit(0)
        elif expected:
            if '#' in expected:
                cmdnum = [term for term in cmd if term.isdigit() ]
            else:
                cmdnum = []
            cmd = [ term for term in cmd if term.lower() in expected ] + cmdnum
    return cmd

def put(msg):
    if isinstance(msg,list):
        for line in msg:
            put(line)
    else:
        print(msg)

def bl_newline(payload,log):
    print()
    return payload

def log(msg,lvl='log',data=''):
    print('logging : [ %s ] %s # %s' % (lvl, msg, str(data)))
