'May return False or None if hash type is invalid for that job -
e.g. attempting to hash by user for anonymous job or by workflow
invocation for jobs outside of workflows.'

def _try_hash_for_job(self, job, hash_by):

    if (hash_by not in VALID_JOB_HASH_STRATEGIES):
        message = ('Do    not    know    how    to    hash    jobs    by    %s,    must    be    one    of    %s' % (hash_by, VALID_JOB_HASH_STRATEGIES))
        raise Exception(message)
    if (hash_by == 'workflow_invocation'):
        return job.raw_param_dict().get('__workflow_invocation_uuid__', None)
    elif (hash_by == 'history'):
        return job.history_id
    elif (hash_by == 'user'):
        user = job.user
        return (user and user.id)
    elif (hash_by == 'job'):
        return job.id
