<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_signature(vcs, user_config, signature):
 """Add `signature` to the list of committed signatures The signature must already be staged Args: vcs (easyci.vcs.base.Vcs) user_config (dict) signature (basestring) Raises: NotStagedError AlreadyCommittedError """

    if signature not in get_staged_signatures(vcs):
        raise NotStagedError
    evidence_path = _get_committed_history_path(vcs)
    committed_signatures = get_committed_signatures(vcs)
    if signature in committed_signatures:
        raise AlreadyCommittedError
    committed_signatures.append(signature)
    string = '\n'.join(committed_signatures[-user_config['history_limit']:])
    with open(evidence_path, 'w') as f:
        f.write(string)
    unstage_signature(vcs, signature)