def get_user_mappings(user_mappings_filename):
    """
    Returns a dict of old-username to new-username based on parsing the given
    user mapping file.
    """
    user_mappings = {}
    with open(user_mappings_filename, "r") as umf:
        for line in umf:
            line = line.strip()
            if line.startswith("#") or line == "":
                continue
            fields = line.split(None, 1)
            if len(fields) == 2:
                old, new = fields
            else:
                # No tab means no change to the username.
                old = new = fields[0]
            user_mappings[old] = new
    return user_mappings