from dateutil import tz
from six import string_types, text_type, binary_type

from django.conf import settings
from django.utils import timezone


def get_central_now():
    utc_now = timezone.now()
    central_tz = tz.gettz('America/Chicago')
    central_now = utc_now.astimezone(central_tz)
    return central_now


def today():
    # catching this because settings.TODAY might literally be None in tests
    # getattr will return None if the value is set to None
    _today = getattr(settings, "TODAY", None)
    if _today:
        return _today
    else:
        return get_central_now().date()


def get_query_params(request):
    try:
        return request.query_params
    except:
        return request.QUERY_PARAMS


def get_request_data(request):
    try:
        return request.data
    except:
        return request.DATA


def is_str(value):
    return isinstance(value, (string_types, text_type, binary_type))


def is_valid_digit(value):
    if isinstance(value, (int, float)):
        return True
    elif is_str(value):
        return value.isdigit()
    return False

@@ -467,16 +467,14 @@
     
-_today =
+return
  get
@@ -500,76 +500,8 @@
 AY%22,
- None)%0A    if _today:%0A        return _today%0A    else:%0A        return
  get
@@ -521,16 +521,17 @@
 ).date()
+)
 %0A%0A%0Adef g

simplify today