<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_origin(event):
 """ Get the origin of an event. :type event: :class:`obspy.core.event.Event` :param event: Event to get the origin of. :return: :class:`obspy.core.event.Origin` """

    if event.preferred_origin() is not None:
        origin = event.preferred_origin()
    elif len(event.origins) > 0:
        origin = event.origins[0]
    else:
        raise IndexError('No origin set, cannot constrain')
    return origin