def read_nexus_field(parent, dataset_name, astype=None):
    """
    get a dataset from the HDF5 parent group
    
    :param obj parent: h5py parent object
    :param str dataset_name: name of the dataset (NeXus field) to be read
    :param obj astype: option to return as different data type
    """
    if dataset_name not in parent:
        return None
    dataset = parent[dataset_name]
    dtype = dataset.dtype
    if astype is not None:
        dtype = astype
    if len(dataset.shape) > 1:
        raise RuntimeError('unexpected %d-D data' % len(dataset.shape))
    if dataset.size > 1:
        return dataset[...].astype(dtype)
    else:
        return dataset[0].astype(dtype)
