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