def load_clients_file(filename):
res = {}<EOL>content = []<EOL>try:<EOL><INDENT>fhandle = file(filename)<EOL>content = fhandle.readlines()<EOL>fhandle.close()<EOL><DEDENT>except IOError:<EOL><INDENT>return None<EOL><DEDENT>linenum = <NUM_LIT:0><EOL>for line in content:<EOL><INDENT>linenum += <NUM_LIT:1><EOL>while line.endswith("<STR_LIT:\r>") or line.endswith("<STR_LIT:\n>"):<EOL><INDENT>line = line[:-<NUM_LIT:1>]<EOL><DEDENT>if re.match("<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>parts = [x.strip() for x in line.split('<STR_LIT:U+002C>')]<EOL>try:<EOL><INDENT>if len(parts) != <NUM_LIT:2>:<EOL><INDENT>raise Exception()<EOL><DEDENT>id_num = int(parts[<NUM_LIT:0>])<EOL>key = base64.b64decode(parts[<NUM_LIT:1>])<EOL>res[id_num] = key<EOL><DEDENT>except:<EOL><INDENT>my_log_message(args, syslog.LOG_ERR, '<STR_LIT>' % (linenum, filename, line))<EOL>return None<EOL><DEDENT><DEDENT>return res<EOL>
Load a list of base64 encoded shared secrets for numerical client ids.

Returns a dict.

Format of file is expected to be

    # This is a comment. Blank lines are OK.

    123,c2hhcmVkIHNlY3JldA==
    456,MTIzNDU2Nzg5MDEyMw==