def METHOD_NAME(stream):
    """Write pmap (w/ the most extended stats supported) to stream"""
    pid = str(os.getpid())
    # -XX/-X are recent linux only
    ex_args = ['XX', 'X', 'x']
    while True:
        cmd = ['pmap', '-' + ex_args.pop(0), pid]
        try:
            pmap = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError:  # pragma: nocover
            if not ex_args:
                raise
        else:
            stream.writelines([' '.join(cmd[:2]), '\n', pmap, '\n\n'])
            break