'Retrieves the current config from the device or cache'

def get_config(self, flags=[]):

    cmd = 'show    running-config    '
    cmd += '    '.join(flags)
    cmd = cmd.strip()
    try:
        return self._device_configs[cmd]
    except KeyError:
        conn = get_connection(self)
        (rc, out, err) = self.exec_command(cmd)
        out = to_text(out, errors='surrogate_then_replace')
        if (rc != 0):
            self._module.fail_json(msg=to_text(err, errors='surrogate_then_replace'))
        cfg = str(out).strip()
        self._device_configs[cmd] = cfg
        return cfg
