import six
import re


def read_meminfo(ssh_client):
    """Read "/proc/meminfo" file and parse all keys and values"""

    cpuinfo = six.BytesIO()
    ssh_client.get_file_obj('/proc/meminfo', cpuinfo)
    lines = cpuinfo.getvalue().decode('utf-8')
    matches = re.findall(r"([\w\(\)]+):\s+(\d+)( kB)*", lines)
    output = {}
    for match in matches:
        output[match[0]] = match[1]

    return output