<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_amendment(self, first_arg, sec_arg, third_arg, fourth_arg=None, commit_msg=None):
 """Remove an amendment Given a amendment_id, branch and optionally an author, remove an amendment on the given branch and attribute the commit to author. Returns the SHA of the commit on branch. """

        if fourth_arg is None:
            amendment_id, branch_name, author = first_arg, sec_arg, third_arg
            gh_user = branch_name.split('_amendment_')[0]
            parent_sha = self.get_master_sha()
        else:
            gh_user, amendment_id, parent_sha, author = first_arg, sec_arg, third_arg, fourth_arg
        if commit_msg is None:
            commit_msg = "Delete Amendment '%s' via OpenTree API" % amendment_id
        return self._remove_document(gh_user, amendment_id, parent_sha, author, commit_msg)