'Render robot "get files" operation status.
This handler relies on URN validation and flow type checking to check the
input parameters to avoid allowing arbitrary reads into the client aff4
space. This handler filters out only the attributes that are appropriate to
release without authorization (authentication is still required).
Args:
args: ApiGetRobotGetFilesOperationStateArgs object.
token: access token.
Returns:
ApiGetRobotGetFilesOperationStateResult object.
Raises:
RobotGetFilesOperationNotFoundError: if operation is not found (i.e.
if the flow is not found or is not a FileFinder flow).
ValueError: if operation id is incorrect. It should match the
aff4:/<client id>/flows/<flow session id> pattern exactly.'

def Handle(self, args, token=None):

    urn = rdfvalue.RDFURN(args.operation_id)
    urn_components = urn.Split()
    if ((len(urn_components) != 3) or (urn_components[1] != 'flows')):
        raise ValueError('Invalid    operation    id.')
    client_urn = rdf_client.ClientURN(urn_components[0])
    rdfvalue.SessionID.ValidateID(urn_components[2])
    flow_id = rdfvalue.SessionID(urn_components[2])
    flow_urn = client_urn.Add('flows').Add(flow_id.Basename())
    try:
        flow_obj = aff4.FACTORY.Open(flow_urn, aff4_type=file_finder.FileFinder, token=token)
    except aff4.InstantiationError:
        raise RobotGetFilesOperationNotFoundError()
    result_collection = flow.GRRFlow.ResultCollectionForFID(flow_urn, token=token)
    result_count = len(result_collection)
    api_flow_obj = ApiFlow().InitFromAff4Object(flow_obj, flow_id=flow_id.Basename())
    return ApiGetRobotGetFilesOperationStateResult(state=api_flow_obj.state, result_count=result_count)
