'Determines language of a code block from shebang lines and whether said
line should be removed or left in place. If the sheband line contains a
path (even a single /) then it is assumed to be a real shebang lines and
left alone. However, if no path is given (e.i.: #!python or :::python)
then it is assumed to be a mock shebang for language identifitation of a
code fragment and removed from the code block prior to processing for
code highlighting. When a mock shebang (e.i: #!python) is found, line
numbering is turned on. When colons are found in place of a shebang
(e.i.: :::python), line numbering is left in the current state - off
by default.'

def _getLang(self):

    import re
    lines = self.src.split('\n')
    fl = lines.pop(0)
    c = re.compile('\n                                                (?:(?:::+)|(?P<shebang>[#]!)) DCTB #    Shebang    or    2    or    more    colons.\n                                                (?P<path>(?:/\\w+)*[/    ])?                                #    Zero    or    1    path    \n                                                (?P<lang>[\\w+-]*)                                                            #    The    language    \n                                                ', re.VERBOSE)
    m = c.search(fl)
    if m:
        try:
            self.lang = m.group('lang').lower()
        except IndexError:
            self.lang = None
        if m.group('path'):
            lines.insert(0, fl)
        if m.group('shebang'):
            self.linenos = True
    else:
        lines.insert(0, fl)
    self.src = '\n'.join(lines).strip('\n')
