<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def preview(df,preview_rows = 20):
#,preview_max_cols = 0):
 """ Returns a preview of a dataframe, which contains both header rows and tail rows. """

    if preview_rows < 4:
        preview_rows = 4
    preview_rows = min(preview_rows,df.shape[0])
    outer = math.floor(preview_rows / 4)
    return pd.concat([df.head(outer),
                      df[outer:-outer].sample(preview_rows-2*outer),
                      df.tail(outer)])