This function is called to check if a username /
    password combination is valid.

def check_auth(username, password):
    """This function is called to check if a username /
    password combination is valid.
    """

    with open(os.path.expanduser("~/config/.note.conf")) as fd:
        config = json.loads(fd.read())

    try:
        u = config['server']['login']['username']
        p = config['server']['login']['password']
    except KeyError:
        print "cannot start server"
        sys.exit(1)

    return username == u and password == p