You can use the numpy.binom.pmf function to calculate the probability mass function of the binomial distribution. This function takes the number of successes, the number of trials, and the probability of success as its arguments.
from scipy.stats import binom
# Parameters
num_trials = 10
prob_success = 0.3
# Calculate PMF for different number of successes
num_successes = 2
pmf = binom.pmf(num_successes, num_trials, prob_success)
print("PMF:", pmf)