A utility function to return samples according to type

def _return_samples(return_type, samples):
    """
        A utility function to return samples according to type
    """
    if return_type.lower() == "dataframe":
        if HAS_PANDAS:
            return pandas.DataFrame.from_records(samples)
        else:
            warn("Pandas installation not found. Returning numpy.recarray object")
            return samples
    else:
        return samples