'Returns a dictionary mapping partitions->(start, end, blocks, id) based
on \'fdisk -l\''

def get_partition_map(self, device=None):

    fdiskout = '\n'.join(self.ssh.execute(('fdisk    -l    %s    2>/dev/null' % (device or ''))))
    part_regex = '/dev/[A-Za-z0-9/]+'
    r = re.compile(('(%s)\\s+\\*?\\s+(\\d+)(?:[-+])?\\s+(\\d+)(?:[-+])?\\s+(\\d+)(?:[-+])?\\s+([\\da-fA-F][\\da-fA-F]?)' % part_regex))
    partmap = {}
    for match in r.findall(fdiskout):
        (part, start, end, blocks, sys_id) = match
        partmap[part] = [int(start), int(end), int(blocks), sys_id]
    return partmap
