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