from statsmodels.tools.data import _is_using_pandas

def _maybe_get_pandas_wrapper(X, K=None):
    """
    If using pandas returns a function to wrap the results, e.g., wrapper(X)
    K is an integer for the symmetric truncation of the series in some filters.
    otherwise returns None
    """
    if _is_using_pandas(X, None):
        index = X.index
        if K is not None:
            index = X.index[K:-K]
        if hasattr(X, "columns"):
            return lambda x : X.__class__(x, index=index, columns=X.columns)
        else:
            return lambda x : X.__class__(x, index=index, name=X.name)

@@ -79,17 +79,20 @@
 pper(X, 
-K
+trim
 =None):%0A
@@ -180,17 +180,20 @@
 (X)%0A    
-K
+trim
  is an i
@@ -249,16 +249,20 @@
  in some
+%0A   
  filters
@@ -367,17 +367,20 @@
      if 
-K
+trim
  is not 
@@ -417,12 +417,18 @@
 dex%5B
-K:-K
+trim:-trim
 %5D%0A  
@@ -550,16 +550,16 @@
   else:%0A
-
         
@@ -621,8 +621,33 @@
 X.name)%0A
+    else:%0A        return%0A

rename K -> trim. Explicit return None.