code: def semimajor(P,M):
      
      if type(P) != Quantity:
          P = P*u.day
      if type(M) != Quantity:
          M = M*u.M_sun
      a = ((P/2/np.pi)**2*const.G*M)**(1./3)
      return a.to(u.AU)
docs: P, M can be ``Quantity`` objects; otherwise default to day, M_sun