'Terminate a flow.
Args:
flow_id: The flow session_id to terminate.
reason: A reason to log.
status: Status code used in the generated status message.
token: The access token to be used for this request.
force: If True then terminate locked flows hard.
Raises:
FlowError: If the flow can not be found.'

@classmethod
def TerminateFlow(cls, flow_id, reason=None, status=None, token=None, force=False):

    if (not force):
        flow_obj = aff4.FACTORY.OpenWithLock(flow_id, aff4_type=GRRFlow, blocking=True, token=token)
    else:
        flow_obj = aff4.FACTORY.Open(flow_id, aff4_type=GRRFlow, mode='rw', token=token)
    if (not flow_obj):
        raise FlowError(('Could    not    terminate    flow    %s' % flow_id))
    with flow_obj:
        runner = flow_obj.GetRunner()
        if (not runner.IsRunning()):
            return
        if (token is None):
            token = access_control.ACLToken()
        if (reason is None):
            reason = 'Manual    termination    by    console.'
        runner.Error(reason, status=status)
        flow_obj.Log('Terminated    by    user    {0}.    Reason:    {1}'.format(token.username, reason))
        super_token = token.SetUID()
        children_to_kill = aff4.FACTORY.MultiOpen(flow_obj.ListChildren(), token=super_token, aff4_type=GRRFlow)
        for child_obj in children_to_kill:
            cls.TerminateFlow(child_obj.urn, reason='Parent    flow    terminated.', token=super_token, force=force)
