def _memory_usage_ps():
    """return memory usage of python process in MB

    >>> isinstance(_memory_usage_ps(),float)
    True

    """
    out = subprocess.Popen(
        ['ps', 'v', '-p', str(os.getpid())],
        stdout=subprocess.PIPE).communicate()[0].split(b'\n')
    vsz_index = out[0].split().index(b'RSS')
    mem = float(out[1].split()[vsz_index]) / 1024
    return mem
def _memory_usage_ps ( ) : out = subprocess . Popen ( [ 'ps' , 'v' , '-p' , str ( os . getpid ( ) ) ] , stdout = subprocess . PIPE ) . communicate ( ) [ 0 ] . split ( b'\n' ) vsz_index = out [ 0 ] . split ( ) . index ( b'RSS' ) mem = float ( out [ 1 ] . split ( ) [ vsz_index ] ) / 1024 return mem
return memory usage of python process in MB

    >>> isinstance(_memory_usage_ps(),float)
    True