# Path: wtframework/wtf/utils/data_utils.py
# def generate_timestamped_string(subject="test", number_of_random_chars=4):
#     """
#     Generate time-stamped string. Format as follows...
# 
#     `2013-01-31_14:12:23_SubjectString_a3Zg`
# 
# 
#     Kwargs:
#         subject (str): String to use as subject.
#         number_of_random_chars (int) : Number of random characters to append.
# 
# 
#     This method is helpful for creating unique names with timestamps in them so 
#     when you have to troubleshoot an issue, the name is easier to find.::
# 
#         self.project_name = generate_timestamped_string("project")
#         new_project_page.create_project(project_name)
# 
#     """
#     random_str = generate_random_string(number_of_random_chars)
#     timestamp = generate_timestamp()
#     return u"{timestamp}_{subject}_{random_str}".format(timestamp=timestamp,
#                                                         subject=subject,
#                                                         random_str=random_str)


import re
import os
import tempfile
import urllib
import codecs
from wtframework.wtf.utils.data_utils import generate_timestamped_string
        temp_file = open(temp_file_path, "wb")
        temp_file.write(string_or_another_file.read())
    else:
        # handle as a string type if we can't handle as a file.
        temp_file = codecs.open(temp_file_path, "w+", "utf-8")
        temp_file.write(string_or_another_file)

    temp_file.close()
    return temp_file_path


def download_to_tempfile(url, file_name=None, extension=None):
    """
    Downloads a URL contents to a tempfile.  This is useful for testing downloads.
    It will download the contents of a URL to a tempfile, which you then can 
    open and use to validate the downloaded contents.

    Args:
        url (str) : URL of the contents to download.

    Kwargs:
        file_name (str): Name of file.
        extension (str): Extension to use.

    Return:
        str - Returns path to the temp file.

    """

    if not file_name:

# Path: wtframework/wtf/utils/data_utils.py
# def generate_timestamped_string(subject="test", number_of_random_chars=4):
#     """
#     Generate time-stamped string. Format as follows...
# 
#     `2013-01-31_14:12:23_SubjectString_a3Zg`
# 
# 
#     Kwargs:
#         subject (str): String to use as subject.
#         number_of_random_chars (int) : Number of random characters to append.
# 
# 
#     This method is helpful for creating unique names with timestamps in them so 
#     when you have to troubleshoot an issue, the name is easier to find.::
# 
#         self.project_name = generate_timestamped_string("project")
#         new_project_page.create_project(project_name)
# 
#     """
#     random_str = generate_random_string(number_of_random_chars)
#     timestamp = generate_timestamp()
#     return u"{timestamp}_{subject}_{random_str}".format(timestamp=timestamp,
#                                                         subject=subject,
#                                                         random_str=random_str)


# Path: wtframework/wtf/utils/file_utils.py
import re
import os
import tempfile
import urllib
import codecs
from wtframework.wtf.utils.data_utils import generate_timestamped_string

        temp_file = open(temp_file_path, "wb")
        temp_file.write(string_or_another_file.read())
    else:
        # handle as a string type if we can't handle as a file.
        temp_file = codecs.open(temp_file_path, "w+", "utf-8")
        temp_file.write(string_or_another_file)

    temp_file.close()
    return temp_file_path


def download_to_tempfile(url, file_name=None, extension=None):
    """
    Downloads a URL contents to a tempfile.  This is useful for testing downloads.
    It will download the contents of a URL to a tempfile, which you then can 
    open and use to validate the downloaded contents.

    Args:
        url (str) : URL of the contents to download.

    Kwargs:
        file_name (str): Name of file.
        extension (str): Extension to use.

    Return:
        str - Returns path to the temp file.

    """

    if not file_name:

        file_name = generate_timestamped_string("wtf_temp_file")