def expand_pv(pv):
    """ Returns the LCS Process Variable in full syntax AADDDNNNCMM as a string
    where AA is two character area,
          DD is device type,
          NNN is device number,
          C  is channel type,
          MM is channel number 
    Returns partial PVs when input string is incomplete.

    Argument:
       pv(str): LCS PV to expane

    """
    # Parse pv
    index = 0
    # Get AA
    if pv[index].isdigit():
        if pv[index+1].isdigit():
            aa = pv[index:2].zfill(2)
            index = 2
        else:
            aa = pv[0].zfill(2)
            index = 1
    else:
        aa = pv[0:2].upper()
        index = 2
    # Get DD
    dd = pv[index:index+2].upper()
    index += 2
    # Get NNN
    ndx = 0
    if index < len(pv):
        while index + ndx < len(pv) and pv[index + ndx].isdigit():
            ndx += 1
        nnn = pv[index: index + ndx].zfill(3)
    else:
        nnn = ""
    # Get C
    index += ndx
    if index < len(pv):
        c = pv[index:index + 1].upper()
        index += 1
    else:
        c = ""
    # Get MM
    if index < len(pv):
        mm = pv[index:].zfill(2) 
    else:
        mm = ""
    return aa + dd + nnn + c + mm