def normalize_path(path):
    """Resolve given path from relative into absolute form."""
    if './' not in path:
        return path
    atoms = []
    for atom in path.split('/'):
        if atom == '.':
            pass
        elif atom == '..':
            if atoms:
                atoms.pop()
        elif atom:
            atoms.append(atom)
    newpath = '/'.join(atoms)
    if path.startswith('/'):
        newpath = '/' + newpath
    return newpath
