trim_tails function

Trim (or expand) head and/or tail