def semimajoraxis(period, mass):
    """ Given period in years and mass in solar masses, return the semi-major axis in au of an orbit using 
        Kepler's third law.
        Written by Logan Pearce, 2019
    """
    import numpy as np
    import astropy.units as u
    try:
        period = period.to(u.yr)
        mass = mass.to(u.Msun)
        sma = ((mass * period ** 2) ** (1 / 3)).value * u.au
    except:
        sma = (mass * period ** 2) ** (1 / 3)
    return sma
