from datetime import datetime


def get_subreddit_data(raw_subreddit):
    """Creates a subreddit object from a PRAW Subreddit instance

    Parameters:

    raw_subreddit (praw.models.Subreddit): PRAW Subreddit instance

    Returns:

    dict: object with information about a subreddit
    """
    date = datetime.fromtimestamp(raw_subreddit.created_utc) if hasattr(raw_subreddit, 'created_utc') else None

    return {
        "date": date.strftime('%Y-%m-%d %H:%M:%S') if date != None else None,
        "can_assign_link_flair": raw_subreddit.can_assign_link_flair if hasattr(raw_subreddit, 'can_assign_link_flair') else None,
        "can_assign_user_flair": raw_subreddit.can_assign_user_flair if hasattr(raw_subreddit, 'can_assign_user_flair') else None,
        "created_utc": raw_subreddit.created_utc if hasattr(raw_subreddit, 'created_utc') else None,
        "description": raw_subreddit.description if hasattr(raw_subreddit, 'description') else None,
        "description_html": raw_subreddit.description_html if hasattr(raw_subreddit, 'description_html') else None,
        "display_name": raw_subreddit.display_name if hasattr(raw_subreddit, 'display_name') else None,
        "id": raw_subreddit.id if hasattr(raw_subreddit, 'id') else None,
        "name": raw_subreddit.name if hasattr(raw_subreddit, 'name') else None,
        "over18": raw_subreddit.over18 if hasattr(raw_subreddit, 'over18') else None,
        "public_description": raw_subreddit.public_description if hasattr(raw_subreddit, 'public_description') else None,
        "spoilers_enabled": raw_subreddit.spoilers_enabled if hasattr(raw_subreddit, 'spoilers_enabled') else None,
        "subscribers": raw_subreddit.subscribers if hasattr(raw_subreddit, 'subscribers') else None
    }