code: def reformat_date(date, new_fmt='%Y-%m-%d'):
      
      try:
          if isinstance(date, datetime):
              return date.strftime(new_fmt)
          else:
              fmt = '%m/%d/%Y'
              return datetime.strptime(date, fmt).strftime(new_fmt)
      except ValueError:
          return date
docs: Returns reformated date.
  
      :param date:
          The string date with this format %m/%d/%Y
      :type date:
          String
      :param new_fmt:
          date format string. Default is '%Y-%m-%d'
      :type date:
          String
  
      :returns:
          int
  
      :example:
          >>> reformat_date('05/1/2015', '%d/%m/%Y')
          '1/05/2015'