
def Nm(nm=0,w=3):
    '''
    >>> Nm(1,3)
    '1'
    >>> Nm(1000,3)
    '1k'
    >>> Nm(1000,3)
    '1k'
    >>> Nm(1000000,3)
    '1m'
    >>> Nm(1000000000,3)
    '1g'
    >>> Nm(100,3)
    '100'
    >>> Nm(10.1,3)
    '10'
    >>> Nm(1.1,3)
    '1.1'
    >>> Nm(0.12,3)
    '0.1'
    >>> Nm(123.456, w=4)
    '123'
    >>> Nm(123.456, w=6)
    '123.45'
    '''
    nmStr = nm.toString()
    return

import time
import sys

class Sh:
    def __init__(self,w=40):
        self.w=w
        self.col=0 # column / w
        print('',end='\r')

    def Bk(self):
        print('',end='\r')
        self.col = 0

    def Pt(self,msg):
        if self.col >= self.w:
            return
        l = len(msg)
        r = self.w - self.col
        if l < r:
            self.col+=l
        else:
            msg=msg[0:r]
            self.col=self.w
        print(msg,end='')

    def Qu(self,msg='',cur=0):
        print('','\r')
        n = self.w if self.w < len(msg) else len(msg)
        print(msg[0:n],'\r')
        return input(msg[0:cur])

    def Wt(self,t=0.1):
        time.sleep(t)

    def Xt(self):
        sys.exit()

    def Co(self,fn=lambda _ : null):
        while fn:
            fn = fn(self)
            tr(data)


        
if __name__ == '__main__':
    sh = Sh(40)
    sh.Wt(1)
    sh.Bk();
    sh.Pt('|___________about this wide____________|')
    sh.Wt(1)
    sh.Bk()
    sh.Pt('currious, what happend with something longer')
    sh.Wt(1)
    sh.Bk()
    sh.Pt('i see' + ' ' * 40)
    sh.Wt(1)
    sh.Bk()
