<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def commit(message, add=False, quiet=False):
 """Commit with that message and return the SHA1 of the commit If add is truish then "$ git add ." first """

    if add:
        run('add .')
    try:
        stdout = run('commit -m %r' % str(message), quiet=quiet)
    except GitError as e:
        s = str(e)
        if 'nothing to commit' in s or 'no changes added to commit' in s:
            raise EmptyCommit(*e.inits())
        raise
    return re.split('[ \]]', stdout.splitlines()[0])[1]