Function to get the coding of a text.
    @param text text to inspect (string)
    @return coding string

def get_coding(text):
    """
    Function to get the coding of a text.
    @param text text to inspect (string)
    @return coding string
    """
    for line in text.splitlines()[:2]:
        result = CODING_RE.search(to_text_string(line))
        if result:
            return result.group(1)
    return None