<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def guard_sample(analysis_request):
 """Returns whether 'sample' transition can be performed or not. Returns True only if the analysis request has the DateSampled and Sampler set or if the user belongs to the Samplers group """

    if analysis_request.getDateSampled() and analysis_request.getSampler():
        return True

    current_user = api.get_current_user()
    return "Sampler" in current_user.getRolesInContext(analysis_request)