def satellite_define_with_TLE(name, norad_id, tle0, tle1, tle2):
    """ Defines an satellite.
    """
    satellite = {'name': name, 'norad_id': norad_id,
                'tle0': tle0, 'tle1': tle1, 'tle2': tle2}
    result = dataio.set_satellite(satellite)
    if result['ok']:
        return result
    else:
        return result['error']
def satellite_define(name, norad_id):
    """ Defines an satellite. TLE info is retrieved from SpaceTrack.
    """
    tle = satellite_get_tle(norad_id)
    satellite = {'name': name, 'norad_id': norad_id,
                'tle0': tle['tle0'], 'tle1': tle['tle1'], 'tle2': tle['tle2']}
    result = dataio.set_satellite(satellite)
    if result['ok']:
        return result
    else:
        return result['error']
def satellite_update_TLE(name):
    """ Updates satellite TLE.
    """
    sat_def = satellite_get(name)
    if not sat_def['ok']:
        return {'error': 'not found'}
    else:
        norad_id = sat_def['results'][0]['norad_id']
        tle = satellite_get_tle(norad_id)
        satellite = {'name': name, 'norad_id': norad_id,
                    'tle0': tle['tle0'], 'tle1': tle['tle1'], 'tle2': tle['tle2']}
        result = dataio.set_satellite(satellite)
        if result['ok']:
            return result
        else:
            return result['error']