def parse(self, file_obj):
configs = [self._config[<NUM_LIT:0>]]<EOL>for line in file_obj:<EOL><INDENT>line = line.rstrip('<STR_LIT:\n>').lstrip()<EOL>if (line == '<STR_LIT>') or (line[<NUM_LIT:0>] == '<STR_LIT:#>'):<EOL><INDENT>continue<EOL><DEDENT>if '<STR_LIT:=>' in line:<EOL><INDENT>key, value = line.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL>key = key.strip().lower()<EOL><DEDENT>else:<EOL><INDENT>i = <NUM_LIT:0><EOL>while (i < len(line)) and not line[i].isspace():<EOL><INDENT>i += <NUM_LIT:1><EOL><DEDENT>if i == len(line):<EOL><INDENT>raise Exception('<STR_LIT>' % line)<EOL><DEDENT>key = line[:i].lower()<EOL>value = line[i:].lstrip()<EOL><DEDENT>if key == '<STR_LIT:host>':<EOL><INDENT>del configs[:]<EOL>for host in value.split():<EOL><INDENT>matches = [c for c in self._config if c['<STR_LIT:host>'] == host]<EOL>if len(matches) > <NUM_LIT:0>:<EOL><INDENT>configs.append(matches[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>config = { '<STR_LIT:host>': host }<EOL>self._config.append(config)<EOL>configs.append(config)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for config in configs:<EOL><INDENT>config[key] = value<EOL><DEDENT><DEDENT><DEDENT>
Read an OpenSSH config from the given file object.

@param file_obj: a file-like object to read the config file from
@type file_obj: file