def timestamp_custom(value, date_format=DATE_STR_FORMAT, local=True):
 try:
  date = dt_util.utc_from_timestamp(value)
  if local:
   date = dt_util.as_local(date)
  return date.strftime(date_format)
 except (ValueError, TypeError):
  return value

def timestamp_custom ( value , date_format = DATE_STR_FORMAT , local = True ) : try : date = dt_util . utc_from_timestamp ( value ) if local : date = dt_util . as_local ( date ) return date . strftime ( date_format ) except ( ValueError , TypeError ) : return value
filter to convert given timestamp to format .