<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def deletecols(X, cols):
 """ Delete columns from a numpy ndarry or recarray. Can take a string giving a column name or comma-separated list of column names, or a list of string column names. Implemented by the tabarray method :func:`tabular.tab.tabarray.deletecols`. **Parameters** **X** : numpy recarray or ndarray with structured dtype The numpy array from which to delete columns. **cols** : string or list of strings Name or list of names of columns in `X`. This can be a string giving a column name or comma-separated list of column names, or a list of string column names. **Returns** **out** : numpy ndarray with structured dtype New numpy ndarray with structured dtype given by `X`, excluding the columns named in `cols`. """

    if isinstance(cols, str):
        cols = cols.split(',')
    retain = [n for n in X.dtype.names if n not in cols]
    if len(retain) > 0:
        return X[retain]
    else:
        return None