<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_git_unchanged(filename, yes=False):
 """Check git to avoid overwriting user changes."""

    if check_staged(filename):
        s = 'There are staged changes in {}, overwrite? [y/n] '.format(filename)
        if yes or input(s) in ('y', 'yes'):
            return
        else:
            raise RuntimeError('There are staged changes in '
                               '{}, aborting.'.format(filename))
    if check_unstaged(filename):
        s = 'There are unstaged changes in {}, overwrite? [y/n] '.format(filename)
        if yes or input(s) in ('y', 'yes'):
            return
        else:
            raise RuntimeError('There are unstaged changes in '
                               '{}, aborting.'.format(filename))