<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _createWorksheet(base, worksheettemplate, analyst):
 """ This function creates a new worksheet takeing advantatge of the analyst variable. If there isn't an analyst definet, the system will puck up the the first one obtained in a query. """

    if not(analyst):
        # Get any analyst
        analyst = getUsers(base, ['Manager', 'LabManager', 'Analyst'])[1]
    folder = base.bika_setup.worksheets
    _id = folder.invokeFactory('Worksheet', id=tmpID())
    ws = folder[_id]
    ws.unmarkCreationFlag()
    new_ws_id = renameAfterCreation(ws)
    ws.edit(
        Number=new_ws_id,
        Analyst=analyst,
        )
    if worksheettemplate:
        ws.applyWorksheetTemplate(worksheettemplate)
    return ws