def get_dxy(nchr_pop1, nchr_pop2, allele1_pop1, allele1_pop2):
  """
  Calculates dxy between two populations.
  """
  p1 = allele1_pop1/nchr_pop1
  p2 = allele1_pop2/nchr_pop2
  dxy = round(p1*(1-p2) + p2*(1-p1), 4)
  return dxy