def get_segment(signal, sampling_rate=22050, start_time=0, end_time=None):
    """
    A function to get part of a signal, where start and end are specified in time.
    :param signal:
    :param sampling_rate:
    :param start_time: in seconds
    :param end_time: in seconds
    :return: The signal after the start and/or end have been trimmed.
    """
    start_frame = sampling_rate * start_time
    if not end_time:
        return signal[int(round(start_frame)):]
    end_frame = sampling_rate * end_time
    return signal[int(round(start_frame)):int(round(end_frame))]