def timedelta_days(days: int) -> timedelta64:
    """
    Convert a duration in days to a NumPy ``timedelta64`` object.
    """
    int_days = int(days)
    if int_days != days:
        raise ValueError("Fractional days passed to timedelta_days: "
                         "{!r}".format(days))
    try:
        # Do not pass e.g. 27.0; that will raise a ValueError.
        # Must be an actual int:
        return timedelta64(int_days, 'D')
    except ValueError as e:
        raise ValueError("Failure in timedelta_days; value was {!r}; original "
                         "error was: {}".format(days, e))
Convert a duration in days to a NumPy ``timedelta64`` object.