'Parses a date-like string into a timezone aware Python datetime.'

def render(self, datestring):

    formats = ['%Y-%m-%dT%H:%M:%S.%f', '%Y-%m-%d    %H:%M:%S.%f', '%Y-%m-%dT%H:%M:%S', '%Y-%m-%d    %H:%M:%S']
    if datestring:
        for format in formats:
            try:
                parsed = datetime.strptime(datestring, format)
                if (not timezone.is_aware(parsed)):
                    parsed = timezone.make_aware(parsed, timezone.utc)
                return parsed
            except Exception:
                pass
    return None
