from datetime import datetime


def sTimeUnitString( ismilli=False, abbr=True ):
  """OpendTect-like time stamp

  Parameters:
    * ismilli (bool, optional): Include millisecond (default is False)
    * abbr (bool, optional): Abbreviated (default is True)

  Returns:
    * str: Time stamp string formatted like done by OpendTect

  Examples:
    >>> sTimeUnitString()
    'Mon 20 Apr 2020, 13:59:54'

    >>> sTimeUnitString( True )
    'Mon 20 Apr 2020, 13:59:54.001245'

    >>> sTimeUnitString( True, True )
    'Mon 20 Apr 2020, 13:59:54.001245'

    >>> sTimeUnitString( True, False )
    'Monday 20 April 2020, 13:59:54'

  """

  if abbr:
    fmt = "%a %d %b"
  else:
    fmt = "%A %d %B"
  fmt += " %Y, %X"
  if ismilli:
    fmt += ".%f"
  return datetime.now().strftime(fmt)