def precisionatk_implementation(y_true, y_pred, k):
    """Fujnction to calculate precision at k for a given sample

    Arguments:
        y_true {list} -- list of actual classes for the given sample
        y_pred {list} -- list of predicted classes for the given sample
        k {[int]} -- top k predictions we are interested in
    """
    # if k = 0 return 0 as we should never have k=0
    # as k is always >=1
    if k == 0:
        return 0
    # as we are interested in top k predictions
    y_pred = y_pred[:k]
    # convert predictions to set
    pred_set = set(y_pred)
    # convert actual values to set
    true_set = set(y_true)
    # find comon values in both
    common_values = pred_set.intersection(true_set)

    # return length of common values over k
    return len(common_values) / len(y_pred[:k])