<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_file(profile, branch, file_path, commit_message=None):
 """Remove a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. branch The name of a branch. file_path The path of the file to delete. commit_message A commit message to give to the commit. Returns: A dict with data about the branch's new ref (it includes the new SHA the branch's HEAD points to, after committing the new file). """

    branch_sha = get_branch_sha(profile, branch)
    tree = get_files_in_branch(profile, branch_sha)
    new_tree = remove_file_from_tree(tree, file_path)
    data = trees.create_tree(profile, new_tree)
    sha = data.get("sha")
    if not commit_message:
        commit_message = "Deleted " + file_path + "."
    parents = [branch_sha]
    commit_data = commits.create_commit(profile, commit_message, sha, parents)
    commit_sha = commit_data.get("sha")
    ref_data = refs.update_ref(profile, "heads/" + branch, commit_sha)
    return ref_data